Commit 55bd2327 authored by alexpott's avatar alexpott

Issue #1969388 by dawehner, tim.plunkett, olli: Add dedicated annotations for Views plugins.

parent 28f1ad6a
......@@ -127,6 +127,9 @@ public function serialize() {
return parent::serialize();
}
/**
* {@inheritdoc}
*/
public function __destruct() {
if ($this->needsCleanup) {
$this->nextIdDelete();
......
......@@ -8,13 +8,13 @@
namespace Drupal\aggregator\Plugin\views\row;
use Drupal\views\Plugin\views\row\RowPluginBase;
use Drupal\Component\Annotation\Plugin;
use Drupal\views\Annotation\ViewsRow;
use Drupal\Core\Annotation\Translation;
/**
* Defines a row plugin which loads an aggregator item and renders as RSS.
*
* @Plugin(
* @ViewsRow(
* id = "aggregator_rss",
* module = "aggregator",
* theme = "views_view_row_rss",
......
......@@ -8,7 +8,7 @@
namespace Drupal\block\Plugin\views\display;
use Drupal\Component\Annotation\Plugin;
use Drupal\views\Annotation\ViewsDisplay;
use Drupal\Core\Annotation\Translation;
use Drupal\views\Plugin\Block\ViewsBlock;
use Drupal\views\Plugin\views\display\DisplayPluginBase;
......@@ -18,7 +18,7 @@
*
* @ingroup views_display_plugins
*
* @Plugin(
* @ViewsDisplay(
* id = "block",
* module = "block",
* title = @Translation("Block"),
......
......@@ -8,13 +8,13 @@
namespace Drupal\comment\Plugin\views\row;
use Drupal\views\Plugin\views\row\RowPluginBase;
use Drupal\Component\Annotation\Plugin;
use Drupal\views\Annotation\ViewsRow;
use Drupal\Core\Annotation\Translation;
/**
* Plugin which formats the comments as RSS items.
*
* @Plugin(
* @ViewsRow(
* id = "comment_rss",
* module = "comment",
* title = @Translation("Comment"),
......
......@@ -8,7 +8,7 @@
namespace Drupal\comment\Plugin\views\wizard;
use Drupal\views\Plugin\views\wizard\WizardPluginBase;
use Drupal\Component\Annotation\Plugin;
use Drupal\views\Annotation\ViewsWizard;
use Drupal\Core\Annotation\Translation;
/**
......@@ -18,7 +18,7 @@
/**
* Tests creating comment views with the wizard.
*
* @Plugin(
* @ViewsWizard(
* id = "comment",
* module = "comment",
* base_table = "comment",
......
......@@ -7,7 +7,7 @@
namespace Drupal\entity_reference\Plugin\views\display;
use Drupal\Component\Annotation\Plugin;
use Drupal\views\Annotation\ViewsDisplay;
use Drupal\Core\Annotation\Translation;
use Drupal\views\Plugin\views\display\DisplayPluginBase;
......@@ -20,7 +20,7 @@
*
* @ingroup views_display_plugins
*
* @Plugin(
* @ViewsDisplay(
* id = "entity_reference",
* title = @Translation("Entity Reference"),
* admin = @Translation("Entity Reference Source"),
......
......@@ -7,7 +7,7 @@
namespace Drupal\entity_reference\Plugin\views\row;
use Drupal\Component\Annotation\Plugin;
use Drupal\views\Annotation\ViewsRow;
use Drupal\Core\Annotation\Translation;
use Drupal\views\Plugin\views\row\Fields;
......@@ -16,7 +16,7 @@
*
* @ingroup views_row_plugins
*
* @Plugin(
* @ViewsRow(
* id = "entity_reference",
* title = @Translation("Entity Reference inline fields"),
* help = @Translation("Displays the fields with an optional template."),
......
......@@ -7,7 +7,7 @@
namespace Drupal\entity_reference\Plugin\views\style;
use Drupal\Component\Annotation\Plugin;
use Drupal\views\Annotation\ViewsStyle;
use Drupal\Core\Annotation\Translation;
use Drupal\views\Plugin\views\style\StylePluginBase;
......@@ -16,7 +16,7 @@
*
* @ingroup views_style_plugins
*
* @Plugin(
* @ViewsStyle(
* id = "entity_reference",
* title = @Translation("Entity Reference list"),
* help = @Translation("Returns results as a PHP array of labels and rendered rows."),
......
......@@ -8,13 +8,13 @@
namespace Drupal\file\Plugin\views\wizard;
use Drupal\views\Plugin\views\wizard\WizardPluginBase;
use Drupal\Component\Annotation\Plugin;
use Drupal\views\Annotation\ViewsWizard;
use Drupal\Core\Annotation\Translation;
/**
* Tests creating managed files views with the wizard.
*
* @Plugin(
* @ViewsWizard(
* id = "file_managed",
* module = "file",
* base_table = "file_managed",
......
......@@ -7,7 +7,7 @@
namespace Drupal\node\Plugin\views\argument_default;
use Drupal\Component\Annotation\Plugin;
use Drupal\views\Annotation\ViewsArgumentDefault;
use Drupal\Core\Annotation\Translation;
use Drupal\views\Plugin\views\argument_default\ArgumentDefaultPluginBase;
......@@ -16,7 +16,7 @@
*
* This plugin actually has no options so it odes not need to do a great deal.
*
* @Plugin(
* @ViewsArgumentDefault(
* id = "node",
* module = "node",
* title = @Translation("Content ID from URL")
......
......@@ -7,14 +7,14 @@
namespace Drupal\node\Plugin\views\argument_validator;
use Drupal\Component\Annotation\Plugin;
use Drupal\views\Annotation\ViewsArgumentValidator;
use Drupal\Core\Annotation\Translation;
use Drupal\views\Plugin\views\argument_validator\ArgumentValidatorPluginBase;
/**
* Validate whether an argument is an acceptable node.
*
* @Plugin(
* @ViewsArgumentValidator(
* id = "node",
* module = "node",
* title = @Translation("Content")
......
......@@ -7,7 +7,7 @@
namespace Drupal\node\Plugin\views\row;
use Drupal\Component\Annotation\Plugin;
use Drupal\views\Annotation\ViewsRow;
use Drupal\Core\Annotation\Translation;
use Drupal\views\Plugin\views\row\RowPluginBase;
......@@ -15,7 +15,7 @@
* Plugin which performs a node_view on the resulting object
* and formats it as an RSS item.
*
* @Plugin(
* @ViewsRow(
* id = "node_rss",
* title = @Translation("Content"),
* help = @Translation("Display the content with standard node view."),
......
......@@ -8,7 +8,7 @@
namespace Drupal\node\Plugin\views\wizard;
use Drupal\views\Plugin\views\wizard\WizardPluginBase;
use Drupal\Component\Annotation\Plugin;
use Drupal\views\Annotation\ViewsWizard;
use Drupal\Core\Annotation\Translation;
/**
......@@ -18,14 +18,13 @@
/**
* Tests creating node views with the wizard.
*
* @Plugin(
* @ViewsWizard(
* id = "node",
* module = "node",
* base_table = "node",
* title = @Translation("Content")
* )
*/
class Node extends WizardPluginBase {
/**
......
......@@ -8,7 +8,7 @@
namespace Drupal\node\Plugin\views\wizard;
use Drupal\views\Plugin\views\wizard\WizardPluginBase;
use Drupal\Component\Annotation\Plugin;
use Drupal\views\Annotation\ViewsWizard;
use Drupal\Core\Annotation\Translation;
/**
......@@ -18,7 +18,7 @@
/**
* Tests creating node revision views with the wizard.
*
* @Plugin(
* @ViewsWizard(
* id = "node_revision",
* module = "node",
* base_table = "node_field_revision",
......
......@@ -7,7 +7,7 @@
namespace Drupal\php\Plugin\views\argument_default;
use Drupal\Component\Annotation\Plugin;
use Drupal\views\Annotation\ViewsArgumentDefault;
use Drupal\Core\Annotation\Translation;
use Drupal\views\Plugin\views\argument_default\ArgumentDefaultPluginBase;
......@@ -15,7 +15,7 @@
/**
* Default argument plugin to provide a PHP code block.
*
* @Plugin(
* @ViewsArgumentDefault(
* id = "php",
* module = "php",
* title = @Translation("PHP Code")
......
......@@ -7,7 +7,7 @@
namespace Drupal\php\Plugin\views\argument_validator;
use Drupal\Component\Annotation\Plugin;
use Drupal\views\Annotation\ViewsArgumentValidator;
use Drupal\Core\Annotation\Translation;
use Drupal\views\Plugin\views\argument_validator\ArgumentValidatorPluginBase;
......@@ -15,7 +15,7 @@
/**
* Provide PHP code to validate whether or not an argument is ok.
*
* @Plugin(
* @ViewsArgumentValidator(
* id = "php",
* module = "php",
* title = @Translation("PHP Code")
......
......@@ -7,7 +7,8 @@
namespace Drupal\rest\Plugin\views\display;
use Drupal\Component\Annotation\Plugin;
use Drupal\views\Annotation\ViewsDisplay;
use Drupal\Core\Annotation\Translation;
use Drupal\Core\ContentNegotiation;
use Drupal\views\ViewExecutable;
......@@ -22,7 +23,7 @@
*
* @ingroup views_display_plugins
*
* @Plugin(
* @ViewsDisplay(
* id = "rest_export",
* module = "rest",
* title = @Translation("REST export"),
......
......@@ -9,7 +9,7 @@
use Drupal\views\ViewExecutable;
use Drupal\views\Plugin\views\row\RowPluginBase;
use Drupal\Component\Annotation\Plugin;
use Drupal\views\Annotation\ViewsRow;
use Drupal\Core\Annotation\Translation;
/**
......@@ -17,7 +17,7 @@
*
* @ingroup views_row_plugins
*
* @Plugin(
* @ViewsRow(
* id = "data_entity",
* module = "rest",
* title = @Translation("Entity"),
......
......@@ -10,7 +10,7 @@
use Drupal\views\ViewExecutable;
use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\Plugin\views\row\RowPluginBase;
use Drupal\Component\Annotation\Plugin;
use Drupal\views\Annotation\ViewsRow;
use Drupal\Core\Annotation\Translation;
/**
......@@ -18,7 +18,7 @@
*
* @ingroup views_row_plugins
*
* @Plugin(
* @ViewsRow(
* id = "data_field",
* module = "rest",
* title = @Translation("Fields"),
......
......@@ -10,7 +10,7 @@
use Drupal\views\ViewExecutable;
use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\Plugin\views\style\StylePluginBase;
use Drupal\Component\Annotation\Plugin;
use Drupal\views\Annotation\ViewsStyle;
use Drupal\Core\Annotation\Translation;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Serializer\SerializerInterface;
......@@ -20,7 +20,7 @@
*
* @ingroup views_style_plugins
*
* @Plugin(
* @ViewsStyle(
* id = "serializer",
* module = "rest",
* title = @Translation("Serializer"),
......
......@@ -8,17 +8,17 @@
namespace Drupal\search\Plugin\views\row;
use Drupal\views\Plugin\views\row\RowPluginBase;
use Drupal\Component\Annotation\Plugin;
use Drupal\views\Annotation\ViewsRow;
use Drupal\Core\Annotation\Translation;
/**
* Plugin which performs a node_view on the resulting object.
*
* @Plugin(
* @ViewsRow(
* id = "search_view",
* module = "search",
* title = @Translation("Search"),
* no_uid = TRUE
* help = @Translation("Provides a row plugin to display search results.")
* )
*/
class SearchRow extends RowPluginBase {
......
......@@ -9,14 +9,14 @@
use Drupal\views\ViewExecutable;
use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\Component\Annotation\Plugin;
use Drupal\views\Annotation\ViewsArgumentDefault;
use Drupal\Core\Annotation\Translation;
use Drupal\views\Plugin\views\argument_default\ArgumentDefaultPluginBase;
/**
* Taxonomy tid default argument.
*
* @Plugin(
* @ViewsArgumentDefault(
* id = "taxonomy_tid",
* module = "taxonomy",
* title = @Translation("Taxonomy term ID from URL")
......
......@@ -9,14 +9,14 @@
use Drupal\views\ViewExecutable;
use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\Component\Annotation\Plugin;
use Drupal\views\Annotation\ViewsArgumentValidator;
use Drupal\Core\Annotation\Translation;
use Drupal\views\Plugin\views\argument_validator\ArgumentValidatorPluginBase;
/**
* Validate whether an argument is an acceptable node.
*
* @Plugin(
* @ViewsArgumentValidator(
* id = "taxonomy_term",
* module = "taxonomy",
* title = @Translation("Taxonomy term")
......
......@@ -8,13 +8,13 @@
namespace Drupal\taxonomy\Plugin\views\wizard;
use Drupal\views\Plugin\views\wizard\WizardPluginBase;
use Drupal\Component\Annotation\Plugin;
use Drupal\views\Annotation\ViewsWizard;
use Drupal\Core\Annotation\Translation;
/**
* Tests creating taxonomy views with the wizard.
*
* @Plugin(
* @ViewsWizard(
* id = "taxonomy_term",
* module = "taxonomy",
* base_table = "taxonomy_term_data",
......
......@@ -7,7 +7,8 @@
namespace Drupal\user\Plugin\views\access;
use Drupal\Component\Annotation\Plugin;
use Drupal\views\Annotation\ViewsAccess;
use Drupal\Core\Session\AccountInterface;
use Drupal\views\Plugin\views\access\AccessPluginBase;
use Drupal\Core\Annotation\Translation;
......@@ -18,7 +19,7 @@
*
* @ingroup views_access_plugins
*
* @Plugin(
* @ViewsAccess(
* id = "perm",
* title = @Translation("Permission"),
* help = @Translation("Access will be granted to users with the specified permission string.")
......
......@@ -7,8 +7,8 @@
namespace Drupal\user\Plugin\views\access;
use Drupal\Component\Annotation\Plugin;
use Drupal\views\Plugin\views\access\AccessPluginBase;
use Drupal\views\Annotation\ViewsAccess;
use Drupal\Core\Annotation\Translation;
use Symfony\Component\Routing\Route;
use Drupal\Core\Session\AccountInterface;
......@@ -18,7 +18,7 @@
*
* @ingroup views_access_plugins
*
* @Plugin(
* @ViewsAccess(
* id = "role",
* title = @Translation("Role"),
* help = @Translation("Access will be granted to users with any of the specified roles.")
......
......@@ -7,7 +7,7 @@
namespace Drupal\user\Plugin\views\argument_default;
use Drupal\Component\Annotation\Plugin;
use Drupal\views\Annotation\ViewsArgumentDefault;
use Drupal\Core\Annotation\Translation;
use Drupal\views\Plugin\views\argument_default\ArgumentDefaultPluginBase;
......@@ -16,7 +16,7 @@
*
* This plugin actually has no options so it odes not need to do a great deal.
*
* @Plugin(
* @ViewsArgumentDefault(
* id = "current_user",
* module = "user",
* title = @Translation("User ID from logged in user")
......
......@@ -8,13 +8,14 @@
namespace Drupal\user\Plugin\views\argument_default;
use Drupal\Component\Annotation\Plugin;
use Drupal\views\Annotation\ViewsArgumentDefault;
use Drupal\Core\Annotation\Translation;
use Drupal\views\Plugin\views\argument_default\ArgumentDefaultPluginBase;
/**
* Default argument plugin to extract a user via menu_get_object.
*
* @Plugin(
* @ViewsArgumentDefault(
* id = "user",
* module = "user",
* title = @Translation("User ID from URL")
......
......@@ -7,7 +7,7 @@
namespace Drupal\user\Plugin\views\argument_validator;
use Drupal\Component\Annotation\Plugin;
use Drupal\views\Annotation\ViewsArgumentValidator;
use Drupal\Core\Annotation\Translation;
use Drupal\Core\Database\Connection;
use Drupal\views\Plugin\views\argument_validator\ArgumentValidatorPluginBase;
......@@ -20,7 +20,7 @@
* converts either one into the user's UID. This validator also sets the
* argument's title to the username.
*
* @Plugin(
* @ViewsArgumentValidator(
* id = "user",
* module = "user",
* title = @Translation("User")
......
......@@ -8,7 +8,7 @@
namespace Drupal\user\Plugin\views\wizard;
use Drupal\views\Plugin\views\wizard\WizardPluginBase;
use Drupal\Component\Annotation\Plugin;
use Drupal\views\Annotation\ViewsWizard;
use Drupal\Core\Annotation\Translation;
/**
......@@ -18,7 +18,7 @@
/**
* Tests creating user views with the wizard.
*
* @Plugin(
* @ViewsWizard(
* id = "users",
* module = "user",
* base_table = "users",
......
<?php
/**
* @file
* Contains \Drupal\views\Plugin\Annotation\ViewsAccess.
*/
namespace Drupal\views\Annotation;
use Drupal\views\Annotation\ViewsPluginAnnotationBase;
/**
* Defines a Plugin annotation object for views access plugins.
*
* @Annotation
*
* @see \Drupal\views\Plugin\views\access\AccessPluginBase
*/
class ViewsAccess extends ViewsPluginAnnotationBase {
/**
* The plugin ID.
*
* @var string
*/
public $id;
/**
* The plugin title used in the views UI.
*
* @var \Drupal\Core\Annotation\Translation
*
* @ingroup plugin_translatable
*/
public $title = '';
/**
* (optional) The short title used in the views UI.
*
* @var \Drupal\Core\Annotation\Translation
*
* @ingroup plugin_translatable
*/
public $short_title = '';
/**
* A short help string; this is displayed in the views UI.
*
* @var \Drupal\Core\Annotation\Translation
*
* @ingroup plugin_translatable
*/
public $help = '';
/**
* The types of the display this plugin can be used with.
*
* For example the Feed display defines the type 'feed', so only rss style
* and row plugins can be used in the views UI.