Commit d116463b authored by dawehner's avatar dawehner Committed by tim.plunkett

convert fields to annotation

parent d21b6884
......@@ -73,7 +73,7 @@
'title' => t('Quantity'),
'help' => t('Quantity of items.'),
'field' => array(
'handler' => 'views_handler_field_numeric',
'plugin_id' => 'numeric',
'click sortable' => TRUE,
),
'filter' => array(
......@@ -90,7 +90,7 @@
'help' => t('Color of item.'),
'field' => array(
'handler' => 'views_handler_field',
'plugin_id' => 'standard',
'click sortable' => TRUE,
),
'filter' => array(
......
......@@ -6,6 +6,7 @@
*/
namespace Drupal\views\Plugins\views\field;
use Drupal\Core\Annotation\Plugin;
/**
* A handler to provide proper displays for booleans.
......@@ -23,6 +24,12 @@
*
* @ingroup views_field_handlers
*/
/**
* @plugin(
* plugin_id = "boolean"
* )
*/
class Boolean extends FieldPluginBase {
function option_definition() {
$options = parent::option_definition();
......
......@@ -7,11 +7,19 @@
namespace Drupal\views\Plugins\views\field;
use Drupal\Core\Annotation\Plugin;
/**
* Provides a handler that adds contextual links.
*
* @ingroup views_field_handlers
*/
/**
* @plugin(
* plugin_id = "contextual_links"
* )
*/
class ContextualLinks extends FieldPluginBase {
function option_definition() {
$options = parent::option_definition();
......
......@@ -7,11 +7,19 @@
namespace Drupal\views\Plugins\views\field;
use Drupal\Core\Annotation\Plugin;
/**
* Field handler to show a counter of the current row.
*
* @ingroup views_field_handlers
*/
/**
* @plugin(
* plugin_id = "counter"
* )
*/
class Counter extends FieldPluginBase {
function option_definition() {
$options = parent::option_definition();
......
......@@ -7,11 +7,19 @@
namespace Drupal\views\Plugins\views\field;
use Drupal\Core\Annotation\Plugin;
/**
* A handler to provide a field that is completely custom by the administrator.
*
* @ingroup views_field_handlers
*/
/**
* @plugin(
* plugin_id = "custom"
* )
*/
class Custom extends FieldPluginBase {
function query() {
// do nothing -- to override the parent query.
......
......@@ -7,11 +7,19 @@
namespace Drupal\views\Plugins\views\field;
use Drupal\Core\Annotation\Plugin;
/**
* A handler to provide proper displays for dates.
*
* @ingroup views_field_handlers
*/
/**
* @plugin(
* plugin_id = "date"
* )
*/
class Date extends FieldPluginBase {
function option_definition() {
$options = parent::option_definition();
......
......@@ -7,6 +7,8 @@
namespace Drupal\views\Plugins\views\field;
use Drupal\Core\Annotation\Plugin;
/**
* A handler to display data from entity objects.
*
......@@ -18,6 +20,12 @@
*
* @ingroup views_field_handlers
*/
/**
* @plugin(
* plugin_id = "entity"
* )
*/
class Entity extends FieldPluginBase {
/**
......
......@@ -7,8 +7,8 @@
namespace Drupal\views\Plugins\views\field;
use Drupal\views\Plugins\views\Plugin;
use Drupal\views\Plugins\views\Handler;
use Drupal\Core\Annotation\Plugin;
/**
* @defgroup views_field_handlers Views field handlers
......@@ -47,6 +47,12 @@
*
* @ingroup views_field_handlers
*/
/**
* @plugin(
* plugin_id = "standard"
* )
*/
class FieldPluginBase extends Handler {
var $field_alias = 'unknown';
......
......@@ -5,13 +5,19 @@
*/
namespace Drupal\views\Plugins\views\field;
use Drupal\views\Plugins\views\field\FieldPluginBase;
use Drupal\Core\Annotation\Plugin;
/**
* Render a numeric value as a size.
*
* @ingroup views_field_handlers
*/
/**
* @plugin(
* plugin_id = "file_size"
* )
*/
class FileSize extends FieldPluginBase {
function option_definition() {
$options = parent::option_definition();
......
......@@ -7,6 +7,8 @@
namespace Drupal\views\Plugins\views\field;
use Drupal\Core\Annotation\Plugin;
/**
* Field handler whichs allows to show machine name content as human name.
* @ingroup views_field_handlers
......@@ -15,6 +17,12 @@
* - options callback: The function to call in order to generate the value options. If omitted, the options 'Yes' and 'No' will be used.
* - options arguments: An array of arguments to pass to the options callback.
*/
/**
* @plugin(
* plugin_id = "machine_name"
* )
*/
class MachineName extends FieldPluginBase {
/**
* @var array Stores the available options.
......
......@@ -7,6 +7,8 @@
namespace Drupal\views\Plugins\views\field;
use Drupal\Core\Annotation\Plugin;
/**
* A handler to run a field through check_markup, using a companion
* format field.
......@@ -18,6 +20,12 @@
*
* @ingroup views_field_handlers
*/
/**
* @plugin(
* plugin_id = "markup"
* )
*/
class Markup extends FieldPluginBase {
/**
* Constructor; calls to base object constructor.
......
......@@ -7,6 +7,8 @@
namespace Drupal\views\Plugins\views\field;
use Drupal\Core\Annotation\Plugin;
/**
* Render a mathematical expression as a numeric value
*
......@@ -16,6 +18,12 @@
*
* @ingroup views_field_handlers
*/
/**
* @plugin(
* plugin_id = "math"
* )
*/
class Math extends FieldPluginBase {
function option_definition() {
$options = parent::option_definition();
......
......@@ -7,6 +7,8 @@
namespace Drupal\views\Plugins\views\field;
use Drupal\Core\Annotation\Plugin;
/**
* Render a field as a numeric value
*
......@@ -16,6 +18,12 @@
*
* @ingroup views_field_handlers
*/
/**
* @plugin(
* plugin_id = "numeric"
* )
*/
class Numeric extends FieldPluginBase {
function option_definition() {
$options = parent::option_definition();
......
......@@ -7,6 +7,8 @@
namespace Drupal\views\Plugins\views\field;
use Drupal\Core\Annotation\Plugin;
/**
* Field handler to provide a list of items.
*
......@@ -17,6 +19,12 @@
*
* @ingroup views_field_handlers
*/
/**
* @plugin(
* plugin_id = "prerender_list"
* )
*/
class PrerenderList extends FieldPluginBase {
/**
* Stores all items which are used to render the items.
......
......@@ -7,11 +7,19 @@
namespace Drupal\views\Plugins\views\field;
use Drupal\Core\Annotation\Plugin;
/**
* Field handler to show data of serialized fields.
*
* @ingroup views_field_handlers
*/
/**
* @plugin(
* plugin_id = "serialized"
* )
*/
class Serialized extends FieldPluginBase {
function option_definition() {
......
......@@ -7,11 +7,19 @@
namespace Drupal\views\Plugins\views\field;
use Drupal\Core\Annotation\Plugin;
/**
* A handler to provide proper displays for time intervals.
*
* @ingroup views_field_handlers
*/
/**
* @plugin(
* plugin_id = "time_interval"
* )
*/
class TimeInterval extends FieldPluginBase {
function option_definition() {
$options = parent::option_definition();
......
......@@ -7,11 +7,19 @@
namespace Drupal\views\Plugins\views\field;
use Drupal\Core\Annotation\Plugin;
/**
* Field handler to provide simple renderer that turns a URL into a clickable link.
*
* @ingroup views_field_handlers
*/
/**
* @plugin(
* plugin_id = "url"
* )
*/
class Url extends FieldPluginBase {
function option_definition() {
$options = parent::option_definition();
......
......@@ -6,12 +6,19 @@
namespace Drupal\views\Plugins\views\field;
use Drupal\views\Plugins\views\field\FieldPluginBase;
use Drupal\Core\Annotation\Plugin;
/**
* A handler to run a field through simple XSS filtering.
*
* @ingroup views_field_handlers
*/
/**
* @plugin(
* plugin_id = "xss"
* )
*/
class Xss extends FieldPluginBase {
function render($values) {
$value = $this->get_value($values);
......
......@@ -122,7 +122,7 @@ protected function viewsData() {
'title' => t('ID'),
'help' => t('The test data ID'),
'field' => array(
'handler' => 'views_handler_field_numeric',
'plugin_id' => 'numeric',
'click sortable' => TRUE,
),
'argument' => array(
......@@ -139,7 +139,7 @@ protected function viewsData() {
'title' => t('Name'),
'help' => t('The name of the person'),
'field' => array(
'handler' => 'views_handler_field',
'plugin_id' => 'standard',
'click sortable' => TRUE,
),
'argument' => array(
......@@ -156,7 +156,7 @@ protected function viewsData() {
'title' => t('Age'),
'help' => t('The age of the person'),
'field' => array(
'handler' => 'views_handler_field_numeric',
'plugin_id' => 'numeric',
'click sortable' => TRUE,
),
'argument' => array(
......@@ -173,7 +173,7 @@ protected function viewsData() {
'title' => t('Job'),
'help' => t('The job of the person'),
'field' => array(
'handler' => 'views_handler_field',
'plugin_id' => 'standard',
'click sortable' => TRUE,
),
'argument' => array(
......@@ -190,7 +190,7 @@ protected function viewsData() {
'title' => t('Created'),
'help' => t('The creation date of this record'),
'field' => array(
'handler' => 'views_handler_field_date',
'plugin_id' => 'date',
'click sortable' => TRUE,
),
'argument' => array(
......
......@@ -33,7 +33,7 @@ function aggregator_views_data() {
'title' => t('Feed Item ID'),
'help' => t('The unique ID of the aggregator item.'),
'field' => array(
'handler' => 'views_handler_field_numeric',
'plugin_id' => 'numeric',
'click sortable' => TRUE,
),
'argument' => array(
......@@ -54,7 +54,7 @@ function aggregator_views_data() {
'help' => t('The unique ID of the aggregator item.'), // The help that appears on the UI,
// Information for displaying the iid
'field' => array(
'handler' => 'views_handler_field_numeric',
'plugin_id' => 'numeric',
'click sortable' => TRUE,
),
// Information for accepting a iid as an argument
......@@ -97,7 +97,7 @@ function aggregator_views_data() {
'title' => t('Link'), // The item it appears as on the UI,
'help' => t('The link to the original source URL of the item.'),
'field' => array(
'handler' => 'views_handler_field_url',
'plugin_id' => 'url',
'click sortable' => TRUE,
),
'sort' => array(
......@@ -172,7 +172,7 @@ function aggregator_views_data() {
'help' => t('The date the original feed item was posted. (With some feeds, this will be the date it was imported.)'),
// Information for displaying a title as a field
'field' => array(
'handler' => 'views_handler_field_date',
'plugin_id' => 'date',
'click sortable' => TRUE,
),
'sort' => array(
......@@ -207,7 +207,7 @@ function aggregator_views_data() {
'help' => t('The unique ID of the aggregator feed.'), // The help that appears on the UI,
// Information for displaying the fid
'field' => array(
'handler' => 'views_handler_field_numeric',
'plugin_id' => 'numeric',
'click sortable' => TRUE,
),
// Information for accepting a fid as an argument
......@@ -254,7 +254,7 @@ function aggregator_views_data() {
'help' => t('The link to the source URL of the feed.'),
// Information for displaying a title as a field
'field' => array(
'handler' => 'views_handler_field_url',
'plugin_id' => 'url',
'click sortable' => TRUE,
),
'sort' => array(
......@@ -271,7 +271,7 @@ function aggregator_views_data() {
'help' => t('The date the feed was last checked for new content.'),
// Information for displaying a title as a field
'field' => array(
'handler' => 'views_handler_field_date',
'plugin_id' => 'date',
'click sortable' => TRUE,
),
'sort' => array(
......@@ -305,7 +305,7 @@ function aggregator_views_data() {
'help' => t('The date of the most recent new content on the feed.'),
// Information for displaying a title as a field
'field' => array(
'handler' => 'views_handler_field_date',
'plugin_id' => 'date',
'click sortable' => TRUE,
),
'sort' => array(
......@@ -348,7 +348,7 @@ function aggregator_views_data() {
'title' => t('Category ID'),
'help' => t('The unique ID of the aggregator category.'),
'field' => array(
'handler' => 'views_handler_field_numeric',
'plugin_id' => 'numeric',
'click sortable' => TRUE,
),
'argument' => array(
......
......@@ -52,7 +52,7 @@ function book_views_data() {
'title' => t('Weight'),
'help' => t('The weight of the book page.'),
'field' => array(
'handler' => 'views_handler_field_numeric',
'plugin_id' => 'numeric',
'click sortable' => TRUE,
),
'sort' => array(
......@@ -64,7 +64,7 @@ function book_views_data() {
'title' => t('Depth'),
'help' => t('The depth of the book page in the hierarchy; top level books have a depth of 1.'),
'field' => array(
'handler' => 'views_handler_field_numeric',
'plugin_id' => 'numeric',
'click sortable' => TRUE,
),
'sort' => array(
......
......@@ -100,7 +100,7 @@ function comment_views_data() {
'title' => t("Author's website"),
'help' => t("The website address of the comment's author. Can be rendered as a link. Will be empty if the author is a registered user."),
'field' => array(
'handler' => 'views_handler_field_url',
'plugin_id' => 'url',
'click sortable' => TRUE,
),
'filter' => array(
......@@ -119,7 +119,7 @@ function comment_views_data() {
'title' => t('Hostname'),
'help' => t('Hostname of user that posted the comment.'),
'field' => array(
'handler' => 'views_handler_field',
'plugin_id' => 'standard',
'click sortable' => TRUE,
),
'filter' => array(
......@@ -138,7 +138,7 @@ function comment_views_data() {
'title' => t('Mail'),
'help' => t('Email of user that posted the comment. Will be empty if the author is a registered user.'),
'field' => array(
'handler' => 'views_handler_field',
'plugin_id' => 'standard',
'click sortable' => TRUE,
),
'filter' => array(
......@@ -157,7 +157,7 @@ function comment_views_data() {
'title' => t('Post date'),
'help' => t('Date and time of when the comment was created.'),
'field' => array(
'handler' => 'views_handler_field_date',
'plugin_id' => 'date',
'click sortable' => TRUE,
),
'sort' => array(
......@@ -196,7 +196,7 @@ function comment_views_data() {
'title' => t('Updated date'),
'help' => t('Date and time of when the comment was last updated.'),
'field' => array(
'handler' => 'views_handler_field_date',
'plugin_id' => 'date',
'click sortable' => TRUE,
),
'sort' => array(
......@@ -272,7 +272,7 @@ function comment_views_data() {
'title' => t('Approved'),
'help' => t('Whether the comment is approved (or still in the moderation queue).'),
'field' => array(
'handler' => 'views_handler_field_boolean',
'plugin_id' => 'boolean',
'click sortable' => TRUE,
'output formats' => array(
'approved-not-approved' => array(t('Approved'), t('Not Approved')),
......@@ -365,7 +365,7 @@ function comment_views_data() {
'handler' => 'views_handler_argument_numeric',
),
'field' => array(
'handler' => 'views_handler_field_numeric',
'plugin_id' => 'numeric',
),
);
......@@ -395,7 +395,7 @@ function comment_views_data() {
'title' => t('Parent CID'),
'help' => t('The Comment ID of the parent comment.'),
'field' => array(
'handler' => 'views_handler_field',
'plugin_id' => 'standard',
),
'relationship' => array(
'title' => t('Parent comment'),
......@@ -459,7 +459,7 @@ function comment_views_data() {
'title' => t('Comment count'),
'help' => t('The number of comments a node has.'),
'field' => array(
'handler' => 'views_handler_field_numeric',
'plugin_id' => 'numeric',
'click sortable' => TRUE,
),
'filter' => array(
......@@ -523,7 +523,7 @@ function comment_views_data() {
'handler' => 'views_handler_argument_numeric',
),
'field' => array(
'handler' => 'views_handler_field_numeric',
'plugin_id' => 'numeric',
),
);
......
......@@ -370,7 +370,7 @@ function field_views_field_default_views_data($field) {
'help' => t('Delta - Appears in: @bundles.', array('@bundles' => implode(', ', $bundles_names))),
);
$data[$table]['delta']['field'] = array(
'handler' => 'views_handler_field_numeric',
'plugin_id' => 'numeric',
);
$data[$table]['delta']['argument'] = array(
'field' => 'delta',
......
......@@ -27,7 +27,7 @@ function language_views_data() {
'title' => t('Language code'),
'help' => t("Language code, e.g. 'de' or 'en-US'."),
'field' => array(
'handler' => 'views_handler_field',
'plugin_id' => 'standard',
),
'filter' => array(
'plugin_id' => 'string'
......@@ -44,7 +44,7 @@ function language_views_data() {
'title' => t('Language name'),
'help' => t("Language name, e.g. 'German' or 'English'."),
'field' => array(
'handler' => 'views_handler_field',
'plugin_id' => 'standard',
),
'filter' => array(
'plugin_id' => 'string'
......@@ -61,7 +61,7 @@ function language_views_data() {
'title' => t('Direction'),
'help' => t('Direction of language (Left-to-Right = 0, Right-to-Left = 1).'),
'field' => array(
'handler' => 'views_handler_field_numeric',
'plugin_id' => 'numeric',
),
'filter' => array(
'plugin_id' => 'numeric'
......@@ -78,7 +78,7 @@ function language_views_data() {
'title' => t('Weight'),
'help' => t('Weight, used in lists of languages.'),
'field' => array(
'handler' => 'views_handler_field_numeric',
'plugin_id' => 'numeric',
),
'filter' => array(
'plugin_id' => 'numeric'
......
......@@ -28,7 +28,7 @@ function locale_views_data() {
'title' => t('LID'),
'help' => t('The ID of the source string.'),
'field' => array(
'handler' => 'views_handler_field',
'plugin_id' => 'standard',
'click sortable' => TRUE,
),
'argument' => array(
......@@ -50,7 +50,7 @@ function locale_views_data() {
'title' => t('Location'),
'help' => t('A description of the location or context of the string.'),
'field' => array(
'handler' => 'views_handler_field',
'plugin_id' => 'standard',
'click sortable' => TRUE,
),
'sort' => array(
......@@ -87,7 +87,7 @@ function locale_views_data() {
'title' => t('Source'),
'help' => t('The full original string.'),
'field' => array(
'handler' => 'views_handler_field',
'plugin_id' => 'standard',
),
'filter' => array(
'plugin_id' => 'string',
......@@ -100,7 +100,7 @@ function locale_views_data() {
'title' => t('Version'),
'help' => t('The version of Drupal core that this string is for.'),
'field' => array(
'handler' => 'views_handler_field',
'plugin_id' => 'standard',
'click sortable' => TRUE,
),
'filter' => array(
......@@ -141,7 +141,7 @@ function locale_views_data() {
'title' => t('Translation'),
'help' => t('The full translation string.'),
'field' => array(
'handler' => 'views_handler_field',
'plugin_id' => 'standard',
),
'filter' => array(
'plugin_id' => 'string',
......@@ -170,7 +170,7 @@ function locale_views_data() {
'title' => t('Singular LID'),
'help' => t('The ID of the parent translation.'),
'field' => array(
'handler' => 'views_handler_field',
'plugin_id' => 'standard',
),
);
......@@ -180,7 +180,7 @@ function locale_views_data() {
'title' => t('Plural'),
'help' => t('Whether or not the translation is plural.'),
'field' => array(
'handler' => 'views_handler_field_boolean',
'plugin_id' => 'boolean',
'click sortable' => TRUE,
),
'filter' => array(
......
......@@ -98,7 +98,7 @@ function node_views_data() {
'title' => t('Post date'), // The item it appears as on the UI,
'help' => t('The date the content was posted.'), // The help that appears on the UI,
'field' => array(
'handler' => 'Drupal\views\Plugins\views\field\Date',
'plugin_id' => 'date',
'click sortable' => TRUE,
),
'sort' => array(
......@@ -114,7 +114,7 @@ function node_views_data() {
'title' => t('Updated date'), // The item it appears as on the UI,
'help' => t('The date the content was last updated.'), // The help that appears on the UI,
'field' => array(
'handler' => 'Drupal\views\Plugins\views\field\Date',
'plugin_id' => 'date',
'click sortable' => TRUE,
),
'sort' => array(
......@@ -149,7 +149,7 @@ function node_views_data() {
'title' => t('Published'),
'help' => t('Whether or not the content is published.'),
'field' => array(
'handler' => 'Drupal\views\Plugins\views\field\Boolean',
'plugin_id' => 'boolean',
'click sortable' => TRUE,
'output formats' => array(
'published-notpublished' => array(t('Published'), t('Not published')),
......@@ -182,7 +182,7 @@ function node_views_data() {