diff --git a/core/modules/comment/src/Plugin/views/argument/UserUid.php b/core/modules/comment/src/Plugin/views/argument/UserUid.php index 792b63cbe5db3e92c6120c0bcc9cf8abb29316ad..22230385a2f394a02c17c031bb07989a7e2fabe4 100644 --- a/core/modules/comment/src/Plugin/views/argument/UserUid.php +++ b/core/modules/comment/src/Plugin/views/argument/UserUid.php @@ -51,6 +51,9 @@ public static function create(ContainerInterface $container, array $configuratio return new static($configuration, $plugin_id, $plugin_definition, $container->get('database')); } + /** + * {@inheritdoc} + */ public function title() { if (!$this->argument) { $title = \Drupal::config('user.settings')->get('anonymous'); @@ -65,6 +68,9 @@ public function title() { return $title; } + /** + * {@inheritdoc} + */ protected function defaultActions($which = NULL) { // Disallow summary views on this argument. if (!$which) { @@ -79,6 +85,9 @@ protected function defaultActions($which = NULL) { } } + /** + * {@inheritdoc} + */ public function query($group_by = FALSE) { $this->ensureMyTable(); diff --git a/core/modules/node/src/Plugin/views/argument/Type.php b/core/modules/node/src/Plugin/views/argument/Type.php index 3b6c5240bd3bbf8b2523909478f2edfa929d0163..a6123b688e2575d84a721ed384555a90a81794b9 100644 --- a/core/modules/node/src/Plugin/views/argument/Type.php +++ b/core/modules/node/src/Plugin/views/argument/Type.php @@ -67,6 +67,9 @@ public function title() { return $this->node_type($this->argument); } + /** + * Returns the label for the given node type. + */ public function node_type($type_name) { $type = $this->nodeTypeStorage->load($type_name); $output = $type ? $type->label() : $this->t('Unknown content type'); diff --git a/core/modules/node/src/Plugin/views/argument/UidRevision.php b/core/modules/node/src/Plugin/views/argument/UidRevision.php index 5505b4af76b223a8a3dff8a4d0a6e522a6a35383..982152080a6b9e33af31772d09525822e4e7e40a 100644 --- a/core/modules/node/src/Plugin/views/argument/UidRevision.php +++ b/core/modules/node/src/Plugin/views/argument/UidRevision.php @@ -15,6 +15,9 @@ )] class UidRevision extends Uid { + /** + * {@inheritdoc} + */ public function query($group_by = FALSE) { $this->ensureMyTable(); $placeholder = $this->placeholder(); diff --git a/core/modules/taxonomy/src/Plugin/views/argument/IndexTid.php b/core/modules/taxonomy/src/Plugin/views/argument/IndexTid.php index ebc76d035663689700d05da2271f5ff836df2029..82ce8b9dc5bb1b5a4943d9c3c18eccf70f5382be 100644 --- a/core/modules/taxonomy/src/Plugin/views/argument/IndexTid.php +++ b/core/modules/taxonomy/src/Plugin/views/argument/IndexTid.php @@ -16,6 +16,9 @@ )] class IndexTid extends ManyToOne { + /** + * {@inheritdoc} + */ public function titleQuery() { $titles = []; $terms = Term::loadMultiple($this->value); diff --git a/core/modules/taxonomy/src/Plugin/views/argument/IndexTidDepth.php b/core/modules/taxonomy/src/Plugin/views/argument/IndexTidDepth.php index b17ce056b81439ee9ae57dd81b15f948c0880c5d..c5b5d186beafcfccec49f00dcc838cd256c164b9 100644 --- a/core/modules/taxonomy/src/Plugin/views/argument/IndexTidDepth.php +++ b/core/modules/taxonomy/src/Plugin/views/argument/IndexTidDepth.php @@ -43,6 +43,9 @@ public static function create(ContainerInterface $container, array $configuratio ); } + /** + * {@inheritdoc} + */ protected function defineOptions() { $options = parent::defineOptions(); @@ -53,6 +56,9 @@ protected function defineOptions() { return $options; } + /** + * {@inheritdoc} + */ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['depth'] = [ '#type' => 'weight', @@ -89,6 +95,9 @@ protected function defaultActions($which = NULL) { return $actions; } + /** + * {@inheritdoc} + */ public function query($group_by = FALSE) { $this->ensureMyTable(); @@ -106,6 +115,9 @@ public function query($group_by = FALSE) { $this->addSubQueryJoin($tids); } + /** + * {@inheritdoc} + */ public function title() { $term = $this->entityRepository->getCanonical('taxonomy_term', $this->argument); if (!empty($term)) { diff --git a/core/modules/taxonomy/src/Plugin/views/argument/IndexTidDepthModifier.php b/core/modules/taxonomy/src/Plugin/views/argument/IndexTidDepthModifier.php index 10b3e87072fb0606390deed851600457ed228793..d660206f86b04d324cb8e91c03ec9bf5e4936206 100644 --- a/core/modules/taxonomy/src/Plugin/views/argument/IndexTidDepthModifier.php +++ b/core/modules/taxonomy/src/Plugin/views/argument/IndexTidDepthModifier.php @@ -19,10 +19,19 @@ )] class IndexTidDepthModifier extends ArgumentPluginBase { + /** + * {@inheritdoc} + */ public function buildOptionsForm(&$form, FormStateInterface $form_state) {} + /** + * {@inheritdoc} + */ public function query($group_by = FALSE) {} + /** + * {@inheritdoc} + */ public function preQuery() { // We don't know our argument yet, but it's based upon our position: $argument = $this->view->args[$this->position] ?? NULL; diff --git a/core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php b/core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php index 18081e18e405cc49e9428234bcb298a18f8111fa..462ea502df8fc7ab691b50f88dcf5375f9fb5a52 100644 --- a/core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php +++ b/core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php @@ -157,6 +157,9 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$ } } + /** + * Checks if the argument has an exception. + */ public function isException($arg = NULL) { if (!isset($arg)) { $arg = $this->argument ?? NULL; @@ -164,6 +167,9 @@ public function isException($arg = NULL) { return !empty($this->options['exception']['value']) && $this->options['exception']['value'] === $arg; } + /** + * Returns the title of the exception for the argument. + */ public function exceptionTitle() { // If title overriding is off for the exception, return the normal title. if (empty($this->options['exception']['title_enable'])) { @@ -183,6 +189,9 @@ public function needsStylePlugin() { return !empty($info['style plugin']) || !empty($validate_info['style plugin']); } + /** + * {@inheritdoc} + */ protected function defineOptions() { $options = parent::defineOptions(); @@ -227,6 +236,9 @@ public static function trustedCallbacks() { return $callbacks; } + /** + * {@inheritdoc} + */ public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); @@ -476,6 +488,9 @@ protected function getTokenHelp() { return $output; } + /** + * {@inheritdoc} + */ public function validateOptionsForm(&$form, FormStateInterface $form_state) { $option_values = &$form_state->getValue('options'); if (empty($option_values)) { @@ -506,6 +521,9 @@ public function validateOptionsForm(&$form, FormStateInterface $form_state) { } + /** + * {@inheritdoc} + */ public function submitOptionsForm(&$form, FormStateInterface $form_state) { $option_values = &$form_state->getValue('options'); if (empty($option_values)) { diff --git a/core/modules/views/src/Plugin/views/argument/DayDate.php b/core/modules/views/src/Plugin/views/argument/DayDate.php index e274c5a481831ca622880243dee2ff6edee945e8..884355a72a4b973317a35ad481966a2628d6a53f 100644 --- a/core/modules/views/src/Plugin/views/argument/DayDate.php +++ b/core/modules/views/src/Plugin/views/argument/DayDate.php @@ -40,6 +40,9 @@ public function title() { return $this->dateFormatter->format(strtotime("2005" . "05" . $day . " 00:00:00 UTC"), 'custom', $this->format, 'UTC'); } + /** + * {@inheritdoc} + */ public function summaryArgument($data) { // Make sure the argument contains leading zeroes. return str_pad($data->{$this->base_alias}, 2, '0', STR_PAD_LEFT); diff --git a/core/modules/views/src/Plugin/views/argument/Formula.php b/core/modules/views/src/Plugin/views/argument/Formula.php index 3ffa4ac2b1ff9c79252e3e5e4d3e4e35bd6b9d17..22a36129b46b286e953247aea420c76fd5e1b01c 100644 --- a/core/modules/views/src/Plugin/views/argument/Formula.php +++ b/core/modules/views/src/Plugin/views/argument/Formula.php @@ -37,6 +37,9 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$ } } + /** + * Gets the prepared formula. + */ public function getFormula() { return str_replace('***table***', $this->tableAlias, $this->formula); } diff --git a/core/modules/views/src/Plugin/views/argument/GroupByNumeric.php b/core/modules/views/src/Plugin/views/argument/GroupByNumeric.php index 03b4568f33aa69c6b4d7831a190ee96d82252d1c..2565fcd6bffdbdb737b53a731127802bee4520ba 100644 --- a/core/modules/views/src/Plugin/views/argument/GroupByNumeric.php +++ b/core/modules/views/src/Plugin/views/argument/GroupByNumeric.php @@ -14,6 +14,9 @@ )] class GroupByNumeric extends ArgumentPluginBase { + /** + * {@inheritdoc} + */ public function query($group_by = FALSE) { $this->ensureMyTable(); $field = $this->getField(); @@ -22,6 +25,9 @@ public function query($group_by = FALSE) { $this->query->addHavingExpression(0, "$field = $placeholder", [$placeholder => $this->argument]); } + /** + * {@inheritdoc} + */ public function adminLabel($short = FALSE) { return $this->getField(parent::adminLabel($short)); } diff --git a/core/modules/views/src/Plugin/views/argument/ManyToOne.php b/core/modules/views/src/Plugin/views/argument/ManyToOne.php index 4b6857747b8ef7c7aa20bd68f66729c13c6c71a1..552562cbbebf5dfe7cdcb1dbbf920054bd6dd20d 100644 --- a/core/modules/views/src/Plugin/views/argument/ManyToOne.php +++ b/core/modules/views/src/Plugin/views/argument/ManyToOne.php @@ -46,6 +46,9 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$ $this->value = []; } + /** + * {@inheritdoc} + */ protected function defineOptions() { $options = parent::defineOptions(); @@ -65,6 +68,9 @@ protected function defineOptions() { return $options; } + /** + * {@inheritdoc} + */ public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); @@ -102,6 +108,9 @@ public function ensureMyTable() { $this->helper->ensureMyTable(); } + /** + * {@inheritdoc} + */ public function query($group_by = FALSE) { $empty = FALSE; if (isset($this->definition['zero is null']) && $this->definition['zero is null']) { @@ -132,6 +141,9 @@ public function query($group_by = FALSE) { $this->helper->addFilter(); } + /** + * {@inheritdoc} + */ public function title() { if (!$this->argument) { return !empty($this->definition['empty field name']) ? $this->definition['empty field name'] : $this->t('Uncategorized'); @@ -159,6 +171,9 @@ public function title() { return implode($this->operator == 'or' ? ' + ' : ', ', $this->titleQuery()); } + /** + * {@inheritdoc} + */ protected function summaryQuery() { $field = $this->table . '.' . $this->field; $join = $this->getJoin(); @@ -182,6 +197,9 @@ protected function summaryQuery() { return $this->summaryBasics(); } + /** + * {@inheritdoc} + */ public function summaryArgument($data) { $value = $data->{$this->base_alias}; if (empty($value)) { diff --git a/core/modules/views/src/Plugin/views/argument/MonthDate.php b/core/modules/views/src/Plugin/views/argument/MonthDate.php index 81ef9985b26173e6243bf14240abc5c207f8a9ba..cec2159c9a3d68a5ec71942b6c9d8740a6e4a0e5 100644 --- a/core/modules/views/src/Plugin/views/argument/MonthDate.php +++ b/core/modules/views/src/Plugin/views/argument/MonthDate.php @@ -48,6 +48,9 @@ public function title() { } } + /** + * {@inheritdoc} + */ public function summaryArgument($data) { // Make sure the argument contains leading zeroes. return str_pad($data->{$this->base_alias}, 2, '0', STR_PAD_LEFT); diff --git a/core/modules/views/src/Plugin/views/argument/NullArgument.php b/core/modules/views/src/Plugin/views/argument/NullArgument.php index 4bfd558282f5030febec9d17b230123eeb86bb43..732caf16e6100528b4136133f1fceafe877cf2a1 100644 --- a/core/modules/views/src/Plugin/views/argument/NullArgument.php +++ b/core/modules/views/src/Plugin/views/argument/NullArgument.php @@ -15,6 +15,9 @@ )] class NullArgument extends ArgumentPluginBase { + /** + * {@inheritdoc} + */ protected function defineOptions() { $options = parent::defineOptions(); $options['must_not_be'] = ['default' => FALSE]; diff --git a/core/modules/views/src/Plugin/views/argument/NumericArgument.php b/core/modules/views/src/Plugin/views/argument/NumericArgument.php index 8d16ed8a0f3eb29265d76f99b5b08360f1cf8bc6..ac5dd39dfe0a0606331e3618818f5525410cafbf 100644 --- a/core/modules/views/src/Plugin/views/argument/NumericArgument.php +++ b/core/modules/views/src/Plugin/views/argument/NumericArgument.php @@ -25,6 +25,9 @@ class NumericArgument extends ArgumentPluginBase { */ public $value; + /** + * {@inheritdoc} + */ protected function defineOptions() { $options = parent::defineOptions(); @@ -34,6 +37,9 @@ protected function defineOptions() { return $options; } + /** + * {@inheritdoc} + */ public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); @@ -55,6 +61,9 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ]; } + /** + * {@inheritdoc} + */ public function title() { if (!$this->argument) { return !empty($this->definition['empty field name']) ? $this->definition['empty field name'] : $this->t('Uncategorized'); @@ -91,6 +100,9 @@ public function titleQuery() { return $this->value; } + /** + * {@inheritdoc} + */ public function query($group_by = FALSE) { $this->ensureMyTable(); diff --git a/core/modules/views/src/Plugin/views/argument/StringArgument.php b/core/modules/views/src/Plugin/views/argument/StringArgument.php index 15a68e0e608d43737407a7385f31f636a0e844de..060f8a69841968480422e7dde763a967af307798 100644 --- a/core/modules/views/src/Plugin/views/argument/StringArgument.php +++ b/core/modules/views/src/Plugin/views/argument/StringArgument.php @@ -43,6 +43,9 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$ } } + /** + * {@inheritdoc} + */ protected function defineOptions() { $options = parent::defineOptions(); @@ -61,6 +64,9 @@ protected function defineOptions() { return $options; } + /** + * {@inheritdoc} + */ public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); @@ -271,6 +277,9 @@ public function query($group_by = FALSE) { } } + /** + * {@inheritdoc} + */ public function summaryArgument($data) { $value = $this->caseTransform($data->{$this->base_alias}, $this->options['path_case']); if (!empty($this->options['transform_dash'])) { @@ -286,6 +295,9 @@ public function getSortName() { return $this->t('Alphabetical', [], ['context' => 'Sort order']); } + /** + * {@inheritdoc} + */ public function title() { // Support case-insensitive title comparisons for PostgreSQL by converting // the title to lowercase. @@ -324,6 +336,9 @@ public function titleQuery() { return $this->value; } + /** + * {@inheritdoc} + */ public function summaryName($data) { return $this->caseTransform(parent::summaryName($data), $this->options['case']); } diff --git a/core/phpcs.xml.dist b/core/phpcs.xml.dist index b3de81b4fc919eeba992f6adb5c5c22fcf697305..af51590c698ba0ae4397791e80b95d355d385bdc 100644 --- a/core/phpcs.xml.dist +++ b/core/phpcs.xml.dist @@ -70,6 +70,7 @@ <exclude name="Drupal.Commenting.FunctionComment.TypeHintMissing"/> </rule> <rule ref="Drupal.Commenting.FunctionComment.Missing"> + <include-pattern>core/modules/*/Plugin/views/argument/*</include-pattern> <include-pattern>core/modules/*/Plugin/views/filter/*</include-pattern> <include-pattern>core/modules/*/Plugin/views/access/*</include-pattern> <include-pattern>core/modules/*/Plugin/views/cache/*</include-pattern>