Commit 797e863f authored by dawehner's avatar dawehner Committed by tim.plunkett

convert a lot of modules to annotations

parent a4235cbc
......@@ -19,7 +19,6 @@
* base_table = "taxonomy_term_data",
* created_column = "created",
* title = @Translation("Taxonomy terms"),
* filters = {""},
* path_field = {
* "id" = "tid",
* "table" = "taxonomy_term_data",
......
......@@ -10,7 +10,18 @@
*
* @ingroup views_argument_handlers
*/
class views_handler_argument_term_node_tid extends views_handler_argument_many_to_one {
namespace Views\taxonomy\Plugin\views\argument;
use Drupal\Core\Annotation\Plugin;
use Drupal\views\Plugin\views\argument\ManyToOne;
/**
* @Plugin(
* plugin_id = "taxonomy_index_tid"
* )
*/
class IndexTid extends ManyToOne {
function option_definition() {
$options = parent::option_definition();
$options['set_breadcrumb'] = array('default' => FALSE, 'bool' => TRUE);
......
......@@ -5,6 +5,11 @@
* Definition of views_handler_argument_term_node_tid_depth.
*/
namespace Views\taxonomy\Plugin\views\argument;
use Drupal\views\Plugin\views\argument\ArgumentPluginBase;
use Drupal\Core\Annotation\Plugin;
/**
* Argument handler for taxonomy terms with depth.
*
......@@ -13,7 +18,13 @@
*
* @ingroup views_argument_handlers
*/
class views_handler_argument_term_node_tid_depth extends views_handler_argument {
/**
* @Plugin(
* plugin_id = "taxonomy_index_tid_depth"
* )
*/
class IndexTidDepth extends ArgumentPluginBase {
function option_definition() {
$options = parent::option_definition();
......
......@@ -2,9 +2,14 @@
/**
* @file
* Definition of views_handler_argument_term_node_tid_depth_modif.
* Definition of views_handler_argument_term_node_tid_depth_modifier.
*/
namespace Views\taxonomy\Plugin\views\argument;
use Drupal\views\Plugin\views\argument\ArgumentPluginBase;
use Drupal\Core\Annotation\Plugin;
/**
* Argument handler for to modify depth for a previous term.
*
......@@ -13,7 +18,13 @@
*
* @ingroup views_argument_handlers
*/
class views_handler_argument_term_node_tid_depth_modifier extends views_handler_argument {
/**
* @Plugin(
* plugin_id = "taxonomy_index_tid_depth_modifier"
* )
*/
class IndexTidDepthModifier extends ArgumentPluginBase {
function options_form(&$form, &$form_state) { }
function query($group_by = FALSE) { }
function pre_query() {
......
......@@ -5,12 +5,23 @@
* Definition of views_handler_argument_taxonomy.
*/
namespace Views\taxonomy\Plugin\views\argument;
use Drupal\views\Plugin\views\argument\Numeric;
use Drupal\Core\Annotation\Plugin;
/**
* Argument handler for basic taxonomy tid.
*
* @ingroup views_argument_handlers
*/
class views_handler_argument_taxonomy extends views_handler_argument_numeric {
/**
* @plugin(
* plugin_id = "taxonomy"
* )
*/
class Taxonomy extends Numeric {
/**
* Override the behavior of title(). Get the title of the node.
......
......@@ -5,14 +5,23 @@
* Definition of views_handler_argument_vocabulary_machine_name.
*/
namespace Views\taxonomy\Plugin\views\argument;
use Drupal\views\Plugin\views\argument\String;
use Drupal\Core\Annotation\Plugin;
/**
* Argument handler to accept a vocabulary machine name.
*
* @ingroup views_argument_handlers
*/
class views_handler_argument_vocabulary_machine_name extends String {
/**
* @Plugin(
* plugin_id = "vocabulary_machine_name"
* )
*/
class VocabularyMachineName extends String {
/**
* Override the behavior of title(). Get the name of the vocabulary..
*/
......
......@@ -5,6 +5,9 @@
* Definition of views_handler_argument_vocabulary_vid.
*/
namespace Views\taxonomy\Plugin\views\argument;
use Drupal\Core\Annotation\Plugin;
use Drupal\views\Plugin\views\argument\Numeric;
/**
......@@ -12,7 +15,13 @@
*
* @ingroup views_argument_handlers
*/
class views_handler_argument_vocabulary_vid extends Numeric {
/**
* @Plugin(
* plugin_id = "vocabulary_vid"
* )
*/
class VocabularyVid extends Numeric {
/**
* Override the behavior of title(). Get the name of the vocabulary.
*/
......
......@@ -5,10 +5,21 @@
* Definition of views_plugin_argument_default_taxonomy_tid.
*/
namespace Views\taxonomy\Plugin\views\argument_default;
use Drupal\Core\Annotation\Plugin;
use Drupal\Core\Annotation\Translation;
use Drupal\views\Plugin\views\argument_default\ArgumentDefaultPluginBase;
/**
* Taxonomy tid default argument.
*
* @Plugin(
* plugin_id = "taxonomy_tid",
* title = @Translation("Taxonomy term ID from URL")
* )
*/
class views_plugin_argument_default_taxonomy_tid extends views_plugin_argument_default {
class Tid extends ArgumentDefaultPluginBase {
function init(&$view, &$argument, $options) {
parent::init($view, $argument, $options);
......
......@@ -5,10 +5,22 @@
* Contains the 'taxonomy term' argument validator plugin.
*/
namespace Views\taxonomy\Plugin\views\argument_validator;
use Drupal\Core\Annotation\Plugin;
use Drupal\Core\Annotation\Translation;
use Drupal\views\Plugin\views\argument_validator\ArgumentValidatorPluginBase;
/**
* Validate whether an argument is an acceptable node.
*
* @Plugin(
* plugin_id = "taxonomy_term",
* title = @Translation("Taxonomy term")
*/
class views_plugin_argument_validate_taxonomy_term extends views_plugin_argument_validate {
class Term extends ArgumentValidatorPluginBase {
function init(&$view, &$argument, $options) {
parent::init($view, $argument, $options);
......
......@@ -5,12 +5,23 @@
* Definition of views_handler_field_term_link_edit.
*/
namespace Views\taxonomy\Plugin\views\field;
use Drupal\views\Plugin\views\field\FieldPluginBase;
use Drupal\Core\Annotation\Plugin;
/**
* Field handler to present a term edit link.
*
* @ingroup views_field_handlers
*/
class views_handler_field_term_link_edit extends views_handler_field {
/**
* @Plugin(
* plugin_id = "term_link_edit"
* )
*/
class LinkEdit extends FieldPluginBase {
function construct() {
parent::construct();
$this->additional_fields['tid'] = 'tid';
......
......@@ -5,13 +5,25 @@
* Definition of views_handler_field_taxonomy.
*/
namespace Views\taxonomy\Plugin\views\field;
use Drupal\views\Plugin\views\field\FieldPluginBase;
use Drupal\Core\Annotation\Plugin;
/**
* Field handler to provide simple renderer that allows linking to a taxonomy
* term.
*
* @ingroup views_field_handlers
*/
class views_handler_field_taxonomy extends views_handler_field {
/**
* @Plugin(
* plugin_id = "taxonomy"
* )
*/
class Taxonomy extends FieldPluginBase {
/**
* Constructor to provide additional field to add.
*
......
......@@ -5,12 +5,23 @@
* Definition of views_handler_field_term_node_tid.
*/
namespace Views\taxonomy\Plugin\views\field;
use Drupal\views\Plugin\views\field\PrerenderList;
use Drupal\Core\Annotation\Plugin;
/**
* Field handler to display all taxonomy terms of a node.
*
* @ingroup views_field_handlers
*/
class views_handler_field_term_node_tid extends views_handler_field_prerender_list {
/**
* @Plugin(
* plugin_id = "taxonomy_index_tid"
* )
*/
class TaxonomyIndexTid extends PrerenderList {
function init(&$view, &$options) {
parent::init($view, $options);
// @todo: Wouldn't it be possible to use $this->base_table and no if here?
......
......@@ -5,12 +5,23 @@
* Definition of views_handler_filter_term_node_tid.
*/
namespace Views\taxonomy\Plugin\views\filter;
use Drupal\Core\Annotation\Plugin;
use Drupal\views\Plugin\views\filter\ManyToOne;
/**
* Filter by term id.
*
* @ingroup views_filter_handlers
*/
class views_handler_filter_term_node_tid extends views_handler_filter_many_to_one {
/**
* @Plugin(
* plugin_id = "taxonomy_index_tid"
* )
*/
class TaxonomyIndexTid extends ManyToOne {
// Stores the exposed input for this filter.
var $validated_exposed_input = NULL;
......
......@@ -5,6 +5,11 @@
* Definition of views_handler_filter_term_node_tid_depth.
*/
namespace Views\taxonomy\Plugin\views\filter;
use Drupal\Core\Annotation\Plugin;
/**
* Filter handler for taxonomy terms with depth.
*
......@@ -13,7 +18,13 @@
*
* @ingroup views_filter_handlers
*/
class views_handler_filter_term_node_tid_depth extends views_handler_filter_term_node_tid {
/**
* @Plugin(
* plugin_id = "taxonomy_index_tid_depth"
* )
*/
class TaxonomyIndexTidDepth extends TaxonomyIndexTid {
function operator_options($which = 'title') {
return array(
'or' => t('Is one of'),
......
......@@ -5,12 +5,23 @@
* Definition of views_handler_filter_vocabulary_machine_name.
*/
namespace Views\taxonomy\Plugin\views\filter;
use Drupal\Core\Annotation\Plugin;
use Drupal\views\Plugin\views\filter\InOperator;
/**
* Filter by vocabulary machine name.
*
* @ingroup views_filter_handlers
*/
class views_handler_filter_vocabulary_machine_name extends views_handler_filter_in_operator {
/**
* @Plugin(
* plugin_id = "vocabulary_machine_name"
* )
*/
class VocabularyMachineName extends InOperator {
function get_value_options() {
if (isset($this->value_options)) {
return;
......
......@@ -5,12 +5,23 @@
* Definition of views_handler_filter_vocabulary_vid.
*/
namespace Views\taxonomy\Plugin\views\filter;
use Drupal\Core\Annotation\Plugin;
use Drupal\views\Plugin\views\filter\InOperator;
/**
* Filter by vocabulary id.
*
* @ingroup views_filter_handlers
*/
class views_handler_filter_vocabulary_vid extends views_handler_filter_in_operator {
/**
* @Plugin(
* plugin_id = "vocabulary_vid"
* )
*/
class VocabularyVid extends InOperator {
function get_value_options() {
if (isset($this->value_options)) {
return;
......
......@@ -5,15 +5,24 @@
* Definition of views_handler_relationship_node_term_data.
*/
namespace Views\taxonomy\Plugin\views\relationship;
use Drupal\views\Join;
use Drupal\views\Plugin\views\relationship\RelationshipPluginBase;
use Drupal\Core\Annotation\Plugin;
/**
* Relationship handler to return the taxonomy terms of nodes.
*
* @ingroup views_relationship_handlers
*/
class views_handler_relationship_node_term_data extends RelationshipPluginBase {
/**
* @Plugin(
* plugin_id = "node_term_data"
* )
*/
class NodeTermData extends RelationshipPluginBase {
function init(&$view, &$options) {
parent::init($view, $options);
......
......@@ -5,12 +5,23 @@
* Provide node tnid argument handler.
*/
namespace Views\translation\Plugin\views\argument;
use Drupal\views\Plugin\views\argument\Numeric;
use Drupal\Core\Annotation\Plugin;
/**
* Argument handler to accept a node translation id.
*
* @ingroup views_argument_handlers
*/
class views_handler_argument_node_tnid extends views_handler_argument_numeric {
/**
* @Plugin(
* plugin_id = "node_tnid"
* )
*/
class NodeTnid extends Numeric {
/**
* Override the behavior of title(). Get the title of the node.
*/
......
......@@ -5,12 +5,23 @@
* Definition of views_handler_field_node_link_translate.
*/
namespace Views\translation\Plugin\views\field;
use Views\node\Plugin\views\field\Link;
use Drupal\Core\Annotation\Plugin;
/**
* Field handler to present a link node translate.
*
* @ingroup views_field_handlers
*/
class views_handler_field_node_link_translate extends views_handler_field_node_link {
/**
* @Plugin(
* plugin_id = "node_link_translate"
* )
*/
class NodeLinkTranslate extends Link {
function render_link($data, $values) {
// ensure user has access to edit this node.
$node = $this->get_value($values);
......
......@@ -5,12 +5,23 @@
* Definition of views_handler_field_node_translation_link.
*/
namespace Views\translation\Plugin\views\field;
use Drupal\views\Plugin\views\field\FieldPluginBase;
use Drupal\Core\Annotation\Plugin;
/**
* Field handler to present a link to the node.
*
* @ingroup views_field_handlers
*/
class views_handler_field_node_translation_link extends views_handler_field {
/**
* @Plugin(
* plugin_id = "node_translation_link"
* )
*/
class NodeTranslationLink extends FieldPluginBase {
function construct() {
parent::construct();
$this->additional_fields['nid'] = 'nid';
......
......@@ -5,12 +5,23 @@
* Definition of views_handler_filter_node_tnid.
*/
namespace Views\translation\Plugin\views\filter;
use Drupal\views\Plugin\views\filter\FilterPluginBase;
use Drupal\Core\Annotation\Plugin;
/**
* Filter by whether the node is the original translation.
*
* @ingroup views_filter_handlers
*/
class views_handler_filter_node_tnid extends views_handler_filter {
/**
* @Plugin(
* plugin_id = "node_tnid"
* )
*/
class NodeTnid extends FilterPluginBase {
function admin_summary() { }
function option_definition() {
$options = parent::option_definition();
......
......@@ -5,12 +5,23 @@
* Definition of views_handler_filter_node_tnid_child.
*/
namespace Views\translation\Plugin\views\filter;
use Drupal\views\Plugin\views\filter\FilterPluginBase;
use Drupal\Core\Annotation\Plugin;
/**
* Filter by whether the node is not the original translation.
*
* @ingroup views_filter_handlers
*/
class views_handler_filter_node_tnid_child extends views_handler_filter {
/**
* @Plugin(
* plugin_id = "node_tnid_child"
* )
*/
class NodeTnidChild extends FilterPluginBase {
function admin_summary() { }
function operator_form(&$form, &$form_state) { }
function can_expose() { return FALSE; }
......
......@@ -5,8 +5,11 @@
* Definition of views_handler_relationship_translation.
*/
namespace Views\translation\Plugin\views\relationship;
use Drupal\views\Join;
use Drupal\views\Plugin\views\relationship\RelationshipPluginBase;
use Drupal\Core\Annotation\Plugin;
/**
* Handles relationships for content translation sets and provides multiple
......@@ -14,7 +17,13 @@
*
* @ingroup views_relationship_handlers
*/
class views_handler_relationship_translation extends RelationshipPluginBase {
/**
* @Plugin(
* plugin_id = "translation"
* )
*/
class Translation extends RelationshipPluginBase {
function option_definition() {
$options = parent::option_definition();
$options['language'] = array('default' => 'current');
......
......@@ -5,6 +5,9 @@
* Definition of views_handler_argument_users_roles_rid.
*/
namespace Views\user\Plugin\views\argument;
use Drupal\Core\Annotation\Plugin;
use Drupal\views\Plugin\views\argument\ManyToOne;
/**
......@@ -12,7 +15,13 @@
*
* @ingroup views_argument_handlers
*/
class views_handler_argument_users_roles_rid extends ManyToOne {
/**
* @Plugin(
* plugin_id = "user_roles_rid"
* )
*/
class RolesRid extends ManyToOne {
function title_query() {
$titles = array();
......
......@@ -5,6 +5,9 @@
* Definition of views_handler_argument_user_uid.
*/
namespace Views\user\Plugin\views\argument;
use Drupal\Core\Annotation\Plugin;
use Drupal\views\Plugin\views\argument\Numeric;
/**
......@@ -12,7 +15,13 @@
*
* @ingroup views_argument_handlers
*/
class views_handler_argument_user_uid extends Numeric {
/**
* @Plugin(
* plugin_id = "user_uid"
* )
*/
class Uid extends Numeric {
/**
* Override the behavior of title(). Get the name of the user.
*
......
......@@ -5,14 +5,23 @@
* Contains the current user argument default plugin.
*/
namespace Views\user\Plugin\views\argument_default;
use Drupal\Core\Annotation\Plugin;
use Drupal\Core\Annotation\Translation;
use Drupal\views\Plugin\views\argument_default\ArgumentDefaultPluginBase;
/**
* Default argument plugin to extract the global $user
*
* This plugin actually has no options so it odes not need to do a great deal.
*
* @Plugin(
* plugin_id = "current_user",
* title = @Translation("User ID from logged in user"),
* )
*/
class views_plugin_argument_default_current_user extends ArgumentDefaultPluginBase {
class CurrentUser extends ArgumentDefaultPluginBase {
function get_argument() {
global $user;
return $user->uid;
......
......@@ -5,12 +5,21 @@
* Contains the user from URL argument default plugin.
*/
namespace Views\user\Plugin\views\argument_default;
use Drupal\Core\Annotation\Plugin;
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(
* plugin_id = "user",
* title = @Translation("User ID from URL"),
* )
*/
class views_plugin_argument_default_user extends ArgumentDefaultPluginBase {
class User extends ArgumentDefaultPluginBase {
function option_definition() {
$options = parent::option_definition();
$options['user'] = array('default' => '', 'bool' => TRUE, 'translatable' => FALSE);
......
......@@ -5,6 +5,10 @@
* Definition of views_plugin_argument_validate_user.
*/
namespace Views\user\Plugin\views\argument_validator;
use Drupal\Core\Annotation\Plugin;
use Drupal\Core\Annotation\Translation;
use Drupal\views\Plugin\views\argument_validator\ArgumentValidatorPluginBase;
/**
......@@ -13,8 +17,13 @@
* This supports either numeric arguments (UID) or strings (username) and
* converts either one into the user's UID. This validator also sets the
* argument's title to the username.
*
* @Plugin(
* plugin_id = "user",
* title = @Translation("User"),
* )
*/
class views_plugin_argument_validate_user extends ArgumentValidatorPluginBase {
class User extends ArgumentValidatorPluginBase {
function option_definition() {
$options = parent::option_definition();
$options['type'] = array('default' => 'uid');
......