Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
f8de053e
Commit
f8de053e
authored
Jul 29, 2012
by
dawehner
Committed by
tim.plunkett
Oct 21, 2012
Browse files
Convert node to annotations and PSR0
parent
20edb75f
Changes
33
Hide whitespace changes
Inline
Side-by-side
lib/Drupal/node/Plugin/views/argument/CreatedDay.php
0 → 100644
View file @
f8de053e
<?php
namespace
Drupal\node\Plugin\views\argument
;
use
Drupal\Core\Annotation\Plugin
;
use
Drupal\views\Plugins\views\argument\Date
;
/**
* Argument handler for a day (DD)
*/
/**
* @Plugin(
* plugin_id = "node_created_day"
* )
*/
class
CreatedDay
extends
Date
{
/**
* Constructor implementation
*/
function
construct
()
{
parent
::
construct
();
$this
->
formula
=
views_date_sql_extract
(
'DAY'
,
"***table***.
$this->real_field
"
);
$this
->
format
=
'j'
;
$this
->
arg_format
=
'd'
;
}
/**
* Provide a link to the next level of the view
*/
function
summary_name
(
$data
)
{
$day
=
str_pad
(
$data
->
{
$this
->
name_alias
},
2
,
'0'
,
STR_PAD_LEFT
);
// strtotime respects server timezone, so we need to set the time fixed as utc time
return
format_date
(
strtotime
(
"2005"
.
"05"
.
$day
.
" 00:00:00 UTC"
),
'custom'
,
$this
->
format
,
'UTC'
);
}
/**
* Provide a link to the next level of the view
*/
function
title
()
{
$day
=
str_pad
(
$this
->
argument
,
2
,
'0'
,
STR_PAD_LEFT
);
return
format_date
(
strtotime
(
"2005"
.
"05"
.
$day
.
" 00:00:00 UTC"
),
'custom'
,
$this
->
format
,
'UTC'
);
}
function
summary_argument
(
$data
)
{
// Make sure the argument contains leading zeroes.
return
str_pad
(
$data
->
{
$this
->
base_alias
},
2
,
'0'
,
STR_PAD_LEFT
);
}
}
lib/Drupal/node/Plugin/views/argument/CreatedFullDate.php
0 → 100644
View file @
f8de053e
<?php
namespace
Drupal\node\Plugin\views\argument
;
use
Drupal\Core\Annotation\Plugin
;
use
Drupal\views\Plugins\views\argument\Date
;
/**
* Argument handler for a full date (CCYYMMDD)
*/
/**
* @Plugin(
* plugin_id = "node_created_fulldate"
* )
*/
class
CreatedFullDate
extends
Date
{
/**
* Constructor implementation
*/
function
construct
()
{
parent
::
construct
();
$this
->
format
=
'F j, Y'
;
$this
->
arg_format
=
'Ymd'
;
$this
->
formula
=
views_date_sql_format
(
$this
->
arg_format
,
"***table***.
$this->real_field
"
);
}
/**
* Provide a link to the next level of the view
*/
function
summary_name
(
$data
)
{
$created
=
$data
->
{
$this
->
name_alias
};
return
format_date
(
strtotime
(
$created
.
" 00:00:00 UTC"
),
'custom'
,
$this
->
format
,
'UTC'
);
}
/**
* Provide a link to the next level of the view
*/
function
title
()
{
return
format_date
(
strtotime
(
$this
->
argument
.
" 00:00:00 UTC"
),
'custom'
,
$this
->
format
,
'UTC'
);
}
}
lib/Drupal/node/Plugin/views/argument/CreatedMonth.php
0 → 100644
View file @
f8de053e
<?php
namespace
Drupal\node\Plugin\views\argument
;
use
Drupal\Core\Annotation\Plugin
;
use
Drupal\views\Plugins\views\argument\Date
;
/**
* Argument handler for a month (MM)
*/
/**
* @Plugin(
* plugin_id = "node_created_month"
* )
*/
class
CreatedMonth
extends
Date
{
/**
* Constructor implementation
*/
function
construct
()
{
parent
::
construct
();
$this
->
formula
=
views_date_sql_extract
(
'MONTH'
,
"***table***.
$this->real_field
"
);
$this
->
format
=
'F'
;
$this
->
arg_format
=
'm'
;
}
/**
* Provide a link to the next level of the view
*/
function
summary_name
(
$data
)
{
$month
=
str_pad
(
$data
->
{
$this
->
name_alias
},
2
,
'0'
,
STR_PAD_LEFT
);
return
format_date
(
strtotime
(
"2005"
.
$month
.
"15"
.
" 00:00:00 UTC"
),
'custom'
,
$this
->
format
,
'UTC'
);
}
/**
* Provide a link to the next level of the view
*/
function
title
()
{
$month
=
str_pad
(
$this
->
argument
,
2
,
'0'
,
STR_PAD_LEFT
);
return
format_date
(
strtotime
(
"2005"
.
$month
.
"15"
.
" 00:00:00 UTC"
),
'custom'
,
$this
->
format
,
'UTC'
);
}
function
summary_argument
(
$data
)
{
// Make sure the argument contains leading zeroes.
return
str_pad
(
$data
->
{
$this
->
base_alias
},
2
,
'0'
,
STR_PAD_LEFT
);
}
}
lib/Drupal/node/Plugin/views/argument/CreatedWeek.php
0 → 100644
View file @
f8de053e
<?php
namespace
Drupal\node\Plugin\views\argument
;
use
Drupal\Core\Annotation\Plugin
;
use
Drupal\views\Plugins\views\argument\Date
;
/**
* Argument handler for a week.
*/
/**
* @Plugin(
* plugin_id = "node_created_week"
*/
class
CreatedWeek
extends
Date
{
/**
* Constructor implementation
*/
function
construct
()
{
parent
::
construct
();
$this
->
arg_format
=
'w'
;
$this
->
formula
=
views_date_sql_extract
(
'WEEK'
,
"***table***.
$this->real_field
"
);
}
/**
* Provide a link to the next level of the view
*/
function
summary_name
(
$data
)
{
$created
=
$data
->
{
$this
->
name_alias
};
return
t
(
'Week @week'
,
array
(
'@week'
=>
$created
));
}
}
lib/Drupal/node/Plugin/views/argument/CreatedYear.php
0 → 100644
View file @
f8de053e
<?php
namespace
Drupal\node\Plugin\views\argument
;
use
Drupal\Core\Annotation\Plugin
;
use
Drupal\views\Plugins\views\argument\Date
;
/**
* Argument handler for a year (CCYY)
*/
/**
* @Plugin(
* plugin_id = "node_created_year"
*/
class
CreatedYear
extends
Date
{
/**
* Constructor implementation
*/
function
construct
()
{
parent
::
construct
();
$this
->
arg_format
=
'Y'
;
$this
->
formula
=
views_date_sql_extract
(
'YEAR'
,
"***table***.
$this->real_field
"
);
}
}
lib/Drupal/node/Plugin/views/argument/CreatedYearMonth.php
0 → 100644
View file @
f8de053e
<?php
namespace
Drupal\node\Plugin\views\argument
;
use
Drupal\Core\Annotation\Plugin
;
use
Drupal\views\Plugins\views\argument\Date
;
/**
* Argument handler for a year plus month (CCYYMM)
*/
/**
* @Plugin(
* plugin_id = "node_created_year_month"
*/
class
CreatedYearMonth
extends
Date
{
/**
* Constructor implementation
*/
function
construct
()
{
parent
::
construct
();
$this
->
format
=
'F Y'
;
$this
->
arg_format
=
'Ym'
;
$this
->
formula
=
views_date_sql_format
(
$this
->
arg_format
,
"***table***.
$this->real_field
"
);
}
/**
* Provide a link to the next level of the view
*/
function
summary_name
(
$data
)
{
$created
=
$data
->
{
$this
->
name_alias
};
return
format_date
(
strtotime
(
$created
.
"15"
.
" 00:00:00 UTC"
),
'custom'
,
$this
->
format
,
'UTC'
);
}
/**
* Provide a link to the next level of the view
*/
function
title
()
{
return
format_date
(
strtotime
(
$this
->
argument
.
"15"
.
" 00:00:00 UTC"
),
'custom'
,
$this
->
format
,
'UTC'
);
}
}
lib/Drupal/node/Plugin/views/argument/
views_handler_argument_node_l
anguage.
inc
→
lib/Drupal/node/Plugin/views/argument/
L
anguage.
php
View file @
f8de053e
...
...
@@ -5,10 +5,21 @@
* Definition of views_handler_argument_node_language.
*/
namespace
Drupal\node\Plugin\views\argument
;
use
Drupal\views\Plugins\views\argument\ArgumentPluginBase
;
use
Drupal\Core\Annotation\Plugin
;
/**
* Argument handler to accept a language.
*/
class
views_handler_argument_node_language
extends
views_handler_argument
{
/**
* @Plugin(
* plugin_id = "node_language"
* )
*/
class
Language
extends
ArgumentPluginBase
{
function
construct
()
{
parent
::
construct
(
'language'
);
}
...
...
lib/Drupal/node/Plugin/views/argument/
views_handler_argument_node_nid.inc
→
lib/Drupal/node/Plugin/views/argument/
Nid.php
View file @
f8de053e
...
...
@@ -5,10 +5,21 @@
* Provide node nid argument handler.
*/
namespace
Drupal\node\Plugin\views\argument
;
use
Drupal\views\Plugins\views\argument\Numeric
;
use
Drupal\Core\Annotation\Plugin
;
/**
* Argument handler to accept a node id.
*/
class
views_handler_argument_node_nid
extends
views_handler_argument_numeric
{
/**
* @Plugin(
* plugin_id = "node_nid"
* )
*/
class
Nid
extends
Numeric
{
/**
* Override the behavior of title(). Get the title of the node.
*/
...
...
lib/Drupal/node/Plugin/views/argument/
views_handler_argument_node_t
ype.
inc
→
lib/Drupal/node/Plugin/views/argument/
T
ype.
php
View file @
f8de053e
...
...
@@ -5,10 +5,21 @@
* Definition of views_handler_argument_node_type.
*/
namespace
Drupal\node\Plugin\views\argument
;
use
Drupal\views\Plugins\views\argument\String
;
use
Drupal\Core\Annotation\Plugin
;
/**
* Argument handler to accept a node type.
*/
class
views_handler_argument_node_type
extends
views_handler_argument_string
{
/**
* @Plugin(
* plugin_id = "node_type"
* )
*/
class
Type
extends
String
{
function
construct
()
{
parent
::
construct
(
'type'
);
}
...
...
lib/Drupal/node/Plugin/views/argument/
views_handler_argument_node_uid_r
evision.
inc
→
lib/Drupal/node/Plugin/views/argument/
UidR
evision.
php
View file @
f8de053e
...
...
@@ -5,11 +5,22 @@
* Defintion of views_handler_argument_node_uid_revision.
*/
namespace
Drupal\node\Plugin\views\argument
;
use
Drupal\user\Plugin\views\argument\UserUid
;
use
Drupal\Core\Annotation\Plugin
;
/**
* Filter handler to accept a user id to check for nodes that
* user posted or created a revision on.
*/
class
views_handler_argument_node_uid_revision
extends
UserUid
{
/**
* @Plugin(
* plugin_id = "node_uid_revision"
* )
*/
class
UidRevision
extends
UserUid
{
function
query
(
$group_by
=
FALSE
)
{
$this
->
ensure_my_table
();
$placeholder
=
$this
->
placeholder
();
...
...
lib/Drupal/node/Plugin/views/argument/
views_handler_argument_node_vid.inc
→
lib/Drupal/node/Plugin/views/argument/
Vid.php
View file @
f8de053e
...
...
@@ -5,10 +5,21 @@
* Provide node vid argument handler.
*/
namespace
Drupal\node\Plugin\views\argument
;
use
Drupal\views\Plugins\views\argument\Numeric
;
use
Drupal\Core\Annotation\Plugin
;
/**
* Argument handler to accept a node revision id.
*/
class
views_handler_argument_node_vid
extends
views_handler_argument_numeric
{
/**
* @Plugin(
* plugin_id = "node_vid"
* )
*/
class
Vid
extends
Numeric
{
// No constructor is necessary.
/**
...
...
lib/Drupal/node/Plugin/views/argument/views_handler_argument_dates_various.inc
deleted
100644 → 0
View file @
20edb75f
<?php
/**
* @file
* Handlers for various date arguments.
*
* @ingroup views_argument_handlers
*/
use
Drupal\views\Plugins\views\argument\Date
;
/**
* Argument handler for a full date (CCYYMMDD)
*/
class
views_handler_argument_node_created_fulldate
extends
Date
{
/**
* Constructor implementation
*/
function
construct
()
{
parent
::
construct
();
$this
->
format
=
'F j, Y'
;
$this
->
arg_format
=
'Ymd'
;
$this
->
formula
=
views_date_sql_format
(
$this
->
arg_format
,
"***table***.
$this->real_field
"
);
}
/**
* Provide a link to the next level of the view
*/
function
summary_name
(
$data
)
{
$created
=
$data
->
{
$this
->
name_alias
};
return
format_date
(
strtotime
(
$created
.
" 00:00:00 UTC"
),
'custom'
,
$this
->
format
,
'UTC'
);
}
/**
* Provide a link to the next level of the view
*/
function
title
()
{
return
format_date
(
strtotime
(
$this
->
argument
.
" 00:00:00 UTC"
),
'custom'
,
$this
->
format
,
'UTC'
);
}
}
/**
* Argument handler for a year (CCYY)
*/
class
views_handler_argument_node_created_year
extends
Date
{
/**
* Constructor implementation
*/
function
construct
()
{
parent
::
construct
();
$this
->
arg_format
=
'Y'
;
$this
->
formula
=
views_date_sql_extract
(
'YEAR'
,
"***table***.
$this->real_field
"
);
}
}
/**
* Argument handler for a year plus month (CCYYMM)
*/
class
views_handler_argument_node_created_year_month
extends
Date
{
/**
* Constructor implementation
*/
function
construct
()
{
parent
::
construct
();
$this
->
format
=
'F Y'
;
$this
->
arg_format
=
'Ym'
;
$this
->
formula
=
views_date_sql_format
(
$this
->
arg_format
,
"***table***.
$this->real_field
"
);
}
/**
* Provide a link to the next level of the view
*/
function
summary_name
(
$data
)
{
$created
=
$data
->
{
$this
->
name_alias
};
return
format_date
(
strtotime
(
$created
.
"15"
.
" 00:00:00 UTC"
),
'custom'
,
$this
->
format
,
'UTC'
);
}
/**
* Provide a link to the next level of the view
*/
function
title
()
{
return
format_date
(
strtotime
(
$this
->
argument
.
"15"
.
" 00:00:00 UTC"
),
'custom'
,
$this
->
format
,
'UTC'
);
}
}
/**
* Argument handler for a month (MM)
*/
class
views_handler_argument_node_created_month
extends
Date
{
/**
* Constructor implementation
*/
function
construct
()
{
parent
::
construct
();
$this
->
formula
=
views_date_sql_extract
(
'MONTH'
,
"***table***.
$this->real_field
"
);
$this
->
format
=
'F'
;
$this
->
arg_format
=
'm'
;
}
/**
* Provide a link to the next level of the view
*/
function
summary_name
(
$data
)
{
$month
=
str_pad
(
$data
->
{
$this
->
name_alias
},
2
,
'0'
,
STR_PAD_LEFT
);
return
format_date
(
strtotime
(
"2005"
.
$month
.
"15"
.
" 00:00:00 UTC"
),
'custom'
,
$this
->
format
,
'UTC'
);
}
/**
* Provide a link to the next level of the view
*/
function
title
()
{
$month
=
str_pad
(
$this
->
argument
,
2
,
'0'
,
STR_PAD_LEFT
);
return
format_date
(
strtotime
(
"2005"
.
$month
.
"15"
.
" 00:00:00 UTC"
),
'custom'
,
$this
->
format
,
'UTC'
);
}
function
summary_argument
(
$data
)
{
// Make sure the argument contains leading zeroes.
return
str_pad
(
$data
->
{
$this
->
base_alias
},
2
,
'0'
,
STR_PAD_LEFT
);
}
}
/**
* Argument handler for a day (DD)
*/
class
views_handler_argument_node_created_day
extends
Date
{
/**
* Constructor implementation
*/
function
construct
()
{
parent
::
construct
();
$this
->
formula
=
views_date_sql_extract
(
'DAY'
,
"***table***.
$this->real_field
"
);
$this
->
format
=
'j'
;
$this
->
arg_format
=
'd'
;
}
/**
* Provide a link to the next level of the view
*/
function
summary_name
(
$data
)
{
$day
=
str_pad
(
$data
->
{
$this
->
name_alias
},
2
,
'0'
,
STR_PAD_LEFT
);
// strtotime respects server timezone, so we need to set the time fixed as utc time
return
format_date
(
strtotime
(
"2005"
.
"05"
.
$day
.
" 00:00:00 UTC"
),
'custom'
,
$this
->
format
,
'UTC'
);
}
/**
* Provide a link to the next level of the view
*/
function
title
()
{
$day
=
str_pad
(
$this
->
argument
,
2
,
'0'
,
STR_PAD_LEFT
);
return
format_date
(
strtotime
(
"2005"
.
"05"
.
$day
.
" 00:00:00 UTC"
),
'custom'
,
$this
->
format
,
'UTC'
);
}
function
summary_argument
(
$data
)
{
// Make sure the argument contains leading zeroes.
return
str_pad
(
$data
->
{
$this
->
base_alias
},
2
,
'0'
,
STR_PAD_LEFT
);
}
}
/**
* Argument handler for a week.
*/
class
views_handler_argument_node_created_week
extends
Date
{
/**
* Constructor implementation
*/
function
construct
()
{
parent
::
construct
();
$this
->
arg_format
=
'w'
;
$this
->
formula
=
views_date_sql_extract
(
'WEEK'
,
"***table***.
$this->real_field
"
);
}
/**
* Provide a link to the next level of the view
*/
function
summary_name
(
$data
)
{
$created
=
$data
->
{
$this
->
name_alias
};
return
t
(
'Week @week'
,
array
(
'@week'
=>
$created
));
}
}
lib/Drupal/node/Plugin/views/argument_default/
views_plugin_argument_default_n
ode.
inc
→
lib/Drupal/node/Plugin/views/argument_default/
N
ode.
php
View file @
f8de053e
...
...
@@ -5,6 +5,10 @@
* Contains the node from URL argument default plugin.
*/
namespace
Drupal\node\Plugin\views\argument_default
;
use
Drupal\Core\Annotation\Plugin
;
use
Drupal\Core\Annotation\Translation
;
use
Drupal\views\Plugins\views\argument_default
\
ArgumentDefaultPluginBase
;
/**
...
...
@@ -12,7 +16,14 @@
*
* This plugin actually has no options so it odes not need to do a great deal.
*/
class
views_plugin_argument_default_node
extends
ArgumentDefaultPluginBase
{
/**
* @Plugin(
* plugin_id = "node",
* title = @Translation("Content ID from URL")
* )
*/
class
Node
extends
ArgumentDefaultPluginBase
{
function
get_argument
()
{
foreach
(
range
(
1
,
3
)
as
$i
)
{
$node
=
menu_get_object
(
'node'
,
$i
);
...
...
lib/Drupal/node/Plugin/views/argument_validat
e/views_plugin_argument_validate_n
ode.
inc
→
lib/Drupal/node/Plugin/views/argument_validat
or/N
ode.
php
View file @
f8de053e
...
...
@@ -5,12 +5,23 @@
* Contains the 'node' argument validator plugin.
*/
namespace
Drupal\node\Plugin\views\argument_validator
;
use
Drupal\Core\Annotation\Plugin
;
use
Drupal\Core\Annotation\Translation
;
use
Drupal\views\Plugins\views\argument_validator
\
ArgumentValidatorPluginBase
;
/**
* Validate whether an argument is an acceptable node.
*/
class
views_plugin_argument_validate_node
extends
ArgumentValidatorPluginBase
{
/**
* @Plugin(
* plugin_id = "node",
* title = @Translation("Content")
* )
*/
class
Node
extends
ArgumentValidatorPluginBase
{
function
option_definition
()
{