summaryrefslogtreecommitdiffstatshomepage
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/modules/comment/src/Plugin/views/argument/UserUid.php9
-rw-r--r--core/modules/node/src/Plugin/views/argument/Type.php3
-rw-r--r--core/modules/node/src/Plugin/views/argument/UidRevision.php3
-rw-r--r--core/modules/taxonomy/src/Plugin/views/argument/IndexTid.php3
-rw-r--r--core/modules/taxonomy/src/Plugin/views/argument/IndexTidDepth.php12
-rw-r--r--core/modules/taxonomy/src/Plugin/views/argument/IndexTidDepthModifier.php9
-rw-r--r--core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php18
-rw-r--r--core/modules/views/src/Plugin/views/argument/DayDate.php3
-rw-r--r--core/modules/views/src/Plugin/views/argument/Formula.php3
-rw-r--r--core/modules/views/src/Plugin/views/argument/GroupByNumeric.php6
-rw-r--r--core/modules/views/src/Plugin/views/argument/ManyToOne.php18
-rw-r--r--core/modules/views/src/Plugin/views/argument/MonthDate.php3
-rw-r--r--core/modules/views/src/Plugin/views/argument/NullArgument.php3
-rw-r--r--core/modules/views/src/Plugin/views/argument/NumericArgument.php12
-rw-r--r--core/modules/views/src/Plugin/views/argument/StringArgument.php15
-rw-r--r--core/phpcs.xml.dist1
16 files changed, 121 insertions, 0 deletions
diff --git a/core/modules/comment/src/Plugin/views/argument/UserUid.php b/core/modules/comment/src/Plugin/views/argument/UserUid.php
index 792b63cbe5d..22230385a2f 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 @@ class UserUid extends ArgumentPluginBase {
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 @@ class UserUid extends ArgumentPluginBase {
return $title;
}
+ /**
+ * {@inheritdoc}
+ */
protected function defaultActions($which = NULL) {
// Disallow summary views on this argument.
if (!$which) {
@@ -79,6 +85,9 @@ class UserUid extends ArgumentPluginBase {
}
}
+ /**
+ * {@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 3b6c5240bd3..a6123b688e2 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 @@ class Type extends StringArgument {
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 5505b4af76b..982152080a6 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 @@ use Drupal\views\Attribute\ViewsArgument;
)]
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 ebc76d03566..82ce8b9dc5b 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 @@ use Drupal\views\Plugin\views\argument\ManyToOne;
)]
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 b17ce056b81..c5b5d186bea 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 @@ class IndexTidDepth extends ArgumentPluginBase implements ContainerFactoryPlugin
);
}
+ /**
+ * {@inheritdoc}
+ */
protected function defineOptions() {
$options = parent::defineOptions();
@@ -53,6 +56,9 @@ class IndexTidDepth extends ArgumentPluginBase implements ContainerFactoryPlugin
return $options;
}
+ /**
+ * {@inheritdoc}
+ */
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
$form['depth'] = [
'#type' => 'weight',
@@ -89,6 +95,9 @@ class IndexTidDepth extends ArgumentPluginBase implements ContainerFactoryPlugin
return $actions;
}
+ /**
+ * {@inheritdoc}
+ */
public function query($group_by = FALSE) {
$this->ensureMyTable();
@@ -106,6 +115,9 @@ class IndexTidDepth extends ArgumentPluginBase implements ContainerFactoryPlugin
$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 10b3e87072f..d660206f86b 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 @@ use Drupal\views\Plugin\views\argument\ArgumentPluginBase;
)]
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 18081e18e40..462ea502df8 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 @@ abstract class ArgumentPluginBase extends HandlerBase implements CacheableDepend
}
}
+ /**
+ * Checks if the argument has an exception.
+ */
public function isException($arg = NULL) {
if (!isset($arg)) {
$arg = $this->argument ?? NULL;
@@ -164,6 +167,9 @@ abstract class ArgumentPluginBase extends HandlerBase implements CacheableDepend
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 @@ abstract class ArgumentPluginBase extends HandlerBase implements CacheableDepend
return !empty($info['style plugin']) || !empty($validate_info['style plugin']);
}
+ /**
+ * {@inheritdoc}
+ */
protected function defineOptions() {
$options = parent::defineOptions();
@@ -227,6 +236,9 @@ abstract class ArgumentPluginBase extends HandlerBase implements CacheableDepend
return $callbacks;
}
+ /**
+ * {@inheritdoc}
+ */
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
@@ -476,6 +488,9 @@ abstract class ArgumentPluginBase extends HandlerBase implements CacheableDepend
return $output;
}
+ /**
+ * {@inheritdoc}
+ */
public function validateOptionsForm(&$form, FormStateInterface $form_state) {
$option_values = &$form_state->getValue('options');
if (empty($option_values)) {
@@ -506,6 +521,9 @@ abstract class ArgumentPluginBase extends HandlerBase implements CacheableDepend
}
+ /**
+ * {@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 e274c5a4818..884355a72a4 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 @@ class DayDate extends Date {
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 3ffa4ac2b1f..22a36129b46 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 @@ class Formula extends ArgumentPluginBase {
}
}
+ /**
+ * 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 03b4568f33a..2565fcd6bff 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 @@ use Drupal\views\Attribute\ViewsArgument;
)]
class GroupByNumeric extends ArgumentPluginBase {
+ /**
+ * {@inheritdoc}
+ */
public function query($group_by = FALSE) {
$this->ensureMyTable();
$field = $this->getField();
@@ -22,6 +25,9 @@ class GroupByNumeric extends ArgumentPluginBase {
$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 4b6857747b8..552562cbbeb 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 @@ class ManyToOne extends ArgumentPluginBase {
$this->value = [];
}
+ /**
+ * {@inheritdoc}
+ */
protected function defineOptions() {
$options = parent::defineOptions();
@@ -65,6 +68,9 @@ class ManyToOne extends ArgumentPluginBase {
return $options;
}
+ /**
+ * {@inheritdoc}
+ */
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
@@ -102,6 +108,9 @@ class ManyToOne extends ArgumentPluginBase {
$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 @@ class ManyToOne extends ArgumentPluginBase {
$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 @@ class ManyToOne extends ArgumentPluginBase {
return implode($this->operator == 'or' ? ' + ' : ', ', $this->titleQuery());
}
+ /**
+ * {@inheritdoc}
+ */
protected function summaryQuery() {
$field = $this->table . '.' . $this->field;
$join = $this->getJoin();
@@ -182,6 +197,9 @@ class ManyToOne extends ArgumentPluginBase {
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 81ef9985b26..cec2159c9a3 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 @@ class MonthDate extends Date {
}
}
+ /**
+ * {@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 4bfd558282f..732caf16e61 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 @@ use Drupal\views\Attribute\ViewsArgument;
)]
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 8d16ed8a0f3..ac5dd39dfe0 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 @@ class NumericArgument extends ArgumentPluginBase {
return $options;
}
+ /**
+ * {@inheritdoc}
+ */
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
@@ -55,6 +61,9 @@ class NumericArgument extends ArgumentPluginBase {
];
}
+ /**
+ * {@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 @@ class NumericArgument extends ArgumentPluginBase {
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 15a68e0e608..060f8a69841 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 @@ class StringArgument extends ArgumentPluginBase {
}
}
+ /**
+ * {@inheritdoc}
+ */
protected function defineOptions() {
$options = parent::defineOptions();
@@ -61,6 +64,9 @@ class StringArgument extends ArgumentPluginBase {
return $options;
}
+ /**
+ * {@inheritdoc}
+ */
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
@@ -271,6 +277,9 @@ class StringArgument extends ArgumentPluginBase {
}
}
+ /**
+ * {@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 @@ class StringArgument extends ArgumentPluginBase {
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 @@ class StringArgument extends ArgumentPluginBase {
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 b3de81b4fc9..af51590c698 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>