diff --git a/core/modules/comment/src/Plugin/views/filter/StatisticsLastUpdated.php b/core/modules/comment/src/Plugin/views/filter/StatisticsLastUpdated.php index 950bffc78ebc4549a38afb874ee5403095dc9c18..837725154f24d63486ebc89b33733ebede4bb905 100644 --- a/core/modules/comment/src/Plugin/views/filter/StatisticsLastUpdated.php +++ b/core/modules/comment/src/Plugin/views/filter/StatisticsLastUpdated.php @@ -19,6 +19,9 @@ class StatisticsLastUpdated extends Date { // phpcs:ignore Drupal.NamingConventions.ValidVariableName.LowerCamelName, Drupal.Commenting.VariableComment.Missing protected ?string $node_table; + /** + * {@inheritdoc} + */ public function query() { $this->ensureMyTable(); $this->node_table = $this->query->ensureTable('node', $this->relationship); diff --git a/core/modules/comment/src/Plugin/views/filter/UserUid.php b/core/modules/comment/src/Plugin/views/filter/UserUid.php index 6e53aa3e5f8e97114b3195492de5059b575e5960..89b85cd2ae795d41f2f5bc5cb9d51dd0706fdad1 100644 --- a/core/modules/comment/src/Plugin/views/filter/UserUid.php +++ b/core/modules/comment/src/Plugin/views/filter/UserUid.php @@ -14,6 +14,9 @@ #[ViewsFilter("comment_user_uid")] class UserUid extends FilterPluginBase { + /** + * {@inheritdoc} + */ public function query() { $this->ensureMyTable(); diff --git a/core/modules/file/src/Plugin/views/filter/Status.php b/core/modules/file/src/Plugin/views/filter/Status.php index 8cf4c6239b5099d44ab195e833aa236b97438dea..d386b862288f91f9e4b6425010b8f7608fcdad15 100644 --- a/core/modules/file/src/Plugin/views/filter/Status.php +++ b/core/modules/file/src/Plugin/views/filter/Status.php @@ -14,6 +14,9 @@ #[ViewsFilter("file_status")] class Status extends InOperator { + /** + * {@inheritdoc} + */ public function getValueOptions() { if (!isset($this->valueOptions)) { $this->valueOptions = [ diff --git a/core/modules/filter/src/Plugin/Filter/FilterHtml.php b/core/modules/filter/src/Plugin/Filter/FilterHtml.php index 98ce48d984b3b36a2863158f065ec918e651b9ef..bbd7a192e4d80ee21eb3fafbc444b9353d47b759 100644 --- a/core/modules/filter/src/Plugin/Filter/FilterHtml.php +++ b/core/modules/filter/src/Plugin/Filter/FilterHtml.php @@ -264,6 +264,9 @@ public function getHTMLRestrictions() { $scanner = new Scanner('<body>' . $html); $parser = new class($scanner, $events) extends Tokenizer { + /** + * {@inheritdoc} + */ public function setTextMode($textMode, $untilTag = NULL) { // Do nothing, we never enter text mode. } diff --git a/core/modules/node/src/Plugin/views/filter/Access.php b/core/modules/node/src/Plugin/views/filter/Access.php index 37db538b7bd9c844838aa79192e53c63b58527f7..4934a2f2e635b642fc7851dab1b4056b9096772b 100644 --- a/core/modules/node/src/Plugin/views/filter/Access.php +++ b/core/modules/node/src/Plugin/views/filter/Access.php @@ -14,10 +14,19 @@ #[ViewsFilter("node_access")] class Access extends FilterPluginBase { + /** + * {@inheritdoc} + */ public function adminSummary() {} + /** + * {@inheritdoc} + */ protected function operatorForm(&$form, FormStateInterface $form_state) {} + /** + * {@inheritdoc} + */ public function canExpose() { return FALSE; } diff --git a/core/modules/node/src/Plugin/views/filter/Status.php b/core/modules/node/src/Plugin/views/filter/Status.php index a0cd335bee0eb8f5cc1624d213ac048cc2c26c10..fbe7d3578a505f63f225beea902eb8311b878ca2 100644 --- a/core/modules/node/src/Plugin/views/filter/Status.php +++ b/core/modules/node/src/Plugin/views/filter/Status.php @@ -14,14 +14,26 @@ #[ViewsFilter("node_status")] class Status extends FilterPluginBase { + /** + * {@inheritdoc} + */ public function adminSummary() {} + /** + * {@inheritdoc} + */ protected function operatorForm(&$form, FormStateInterface $form_state) {} + /** + * {@inheritdoc} + */ public function canExpose() { return FALSE; } + /** + * {@inheritdoc} + */ public function query() { $table = $this->ensureMyTable(); $snippet = "$table.status = 1 OR ($table.uid = ***CURRENT_USER*** AND ***CURRENT_USER*** <> 0 AND ***VIEW_OWN_UNPUBLISHED_NODES*** = 1) OR ***BYPASS_NODE_ACCESS*** = 1"; diff --git a/core/modules/node/src/Plugin/views/filter/UidRevision.php b/core/modules/node/src/Plugin/views/filter/UidRevision.php index 7f986549c2fee5591d580f7ede9ed63b118732d6..b7f186fa07d111641108817316d859525bd0fd8c 100644 --- a/core/modules/node/src/Plugin/views/filter/UidRevision.php +++ b/core/modules/node/src/Plugin/views/filter/UidRevision.php @@ -13,6 +13,9 @@ #[ViewsFilter("node_uid_revision")] class UidRevision extends Name { + /** + * {@inheritdoc} + */ public function query($group_by = FALSE) { $this->ensureMyTable(); diff --git a/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php b/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php index 4cad71a81d16460675e3516009d168b4378c7fb5..49a05d4c901d3cf551605a47221e6f7c06c51b72 100644 --- a/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php +++ b/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php @@ -99,6 +99,9 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$ } } + /** + * {@inheritdoc} + */ public function hasExtraOptions() { return TRUE; } @@ -110,6 +113,9 @@ public function getValueOptions() { return $this->valueOptions; } + /** + * {@inheritdoc} + */ protected function defineOptions() { $options = parent::defineOptions(); @@ -122,6 +128,9 @@ protected function defineOptions() { return $options; } + /** + * {@inheritdoc} + */ public function buildExtraOptionsForm(&$form, FormStateInterface $form_state) { $vocabularies = $this->vocabularyStorage->loadMultiple(); $options = []; @@ -166,6 +175,9 @@ public function buildExtraOptionsForm(&$form, FormStateInterface $form_state) { ]; } + /** + * {@inheritdoc} + */ protected function valueForm(&$form, FormStateInterface $form_state) { $vocabulary = $this->vocabularyStorage->load($this->options['vid']); if (empty($vocabulary) && $this->options['limit']) { @@ -285,6 +297,9 @@ protected function valueForm(&$form, FormStateInterface $form_state) { } } + /** + * {@inheritdoc} + */ protected function valueValidate($form, FormStateInterface $form_state) { // We only validate if they've chosen the text field style. if ($this->options['type'] != 'textfield') { @@ -300,6 +315,9 @@ protected function valueValidate($form, FormStateInterface $form_state) { $form_state->setValue(['options', 'value'], $tids); } + /** + * {@inheritdoc} + */ public function acceptExposedInput($input) { if (empty($this->options['exposed'])) { return TRUE; @@ -339,6 +357,9 @@ public function acceptExposedInput($input) { return $rc; } + /** + * {@inheritdoc} + */ public function validateExposed(&$form, FormStateInterface $form_state) { if (empty($this->options['exposed'])) { return; @@ -371,10 +392,16 @@ public function validateExposed(&$form, FormStateInterface $form_state) { } } + /** + * {@inheritdoc} + */ protected function valueSubmit($form, FormStateInterface $form_state) { // Prevent array_filter from messing up our arrays in parent submit. } + /** + * {@inheritdoc} + */ public function buildExposeForm(&$form, FormStateInterface $form_state) { parent::buildExposeForm($form, $form_state); if ($this->options['type'] != 'select') { @@ -387,6 +414,9 @@ public function buildExposeForm(&$form, FormStateInterface $form_state) { ]; } + /** + * {@inheritdoc} + */ public function adminSummary() { // Set up $this->valueOptions for the parent summary $this->valueOptions = []; diff --git a/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTidDepth.php b/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTidDepth.php index f54df951646eb0e34d160918ec2ecfd3d140ff5d..69067ce820f2905248c5c09c7fc1fcdd8778134b 100644 --- a/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTidDepth.php +++ b/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTidDepth.php @@ -18,12 +18,18 @@ class TaxonomyIndexTidDepth extends TaxonomyIndexTid { use TaxonomyIndexDepthQueryTrait; + /** + * {@inheritdoc} + */ public function operatorOptions($which = 'title') { return [ 'or' => $this->t('Is one of'), ]; } + /** + * {@inheritdoc} + */ protected function defineOptions() { $options = parent::defineOptions(); @@ -32,6 +38,9 @@ protected function defineOptions() { return $options; } + /** + * {@inheritdoc} + */ public function buildExtraOptionsForm(&$form, FormStateInterface $form_state) { parent::buildExtraOptionsForm($form, $form_state); @@ -43,6 +52,9 @@ public function buildExtraOptionsForm(&$form, FormStateInterface $form_state) { ]; } + /** + * {@inheritdoc} + */ public function query() { // If no filter values are present, then do nothing. if (count($this->value) == 0) { diff --git a/core/modules/user/src/Plugin/views/filter/Current.php b/core/modules/user/src/Plugin/views/filter/Current.php index 07871fa24afe7522fb6805588bba0239902c7d60..b8fb28e8903961312365ecf7380c2efdb8f28880 100644 --- a/core/modules/user/src/Plugin/views/filter/Current.php +++ b/core/modules/user/src/Plugin/views/filter/Current.php @@ -24,6 +24,9 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$ $this->value_value = $this->t('Is the logged in user'); } + /** + * {@inheritdoc} + */ public function query() { $this->ensureMyTable(); diff --git a/core/modules/user/src/Plugin/views/filter/Name.php b/core/modules/user/src/Plugin/views/filter/Name.php index a5ca2d40b767a848058fd5f7e9684f70fbf626b2..27847e0b91de88cd37fac03bf0d7ebbcc03ec40d 100644 --- a/core/modules/user/src/Plugin/views/filter/Name.php +++ b/core/modules/user/src/Plugin/views/filter/Name.php @@ -24,6 +24,9 @@ class Name extends InOperator { // phpcs:ignore Drupal.NamingConventions.ValidVariableName.LowerCamelName, Drupal.Commenting.VariableComment.Missing protected array $validated_exposed_input; + /** + * {@inheritdoc} + */ protected function valueForm(&$form, FormStateInterface $form_state) { $users = $this->value ? User::loadMultiple($this->value) : []; $default_value = EntityAutocomplete::getEntityLabels($users); @@ -44,6 +47,9 @@ protected function valueForm(&$form, FormStateInterface $form_state) { } } + /** + * {@inheritdoc} + */ protected function valueValidate($form, FormStateInterface $form_state) { $uids = []; if ($values = $form_state->getValue(['options', 'value'])) { @@ -55,6 +61,9 @@ protected function valueValidate($form, FormStateInterface $form_state) { $form_state->setValue(['options', 'value'], $uids); } + /** + * {@inheritdoc} + */ public function acceptExposedInput($input) { $rc = parent::acceptExposedInput($input); @@ -68,6 +77,9 @@ public function acceptExposedInput($input) { return $rc; } + /** + * {@inheritdoc} + */ public function validateExposed(&$form, FormStateInterface $form_state) { if (empty($this->options['exposed'])) { return; @@ -98,6 +110,9 @@ public function validateExposed(&$form, FormStateInterface $form_state) { } } + /** + * {@inheritdoc} + */ protected function valueSubmit($form, FormStateInterface $form_state) { // Prevent array filter from removing our anonymous user. } @@ -109,6 +124,9 @@ public function getValueOptions() { return $this->valueOptions; } + /** + * {@inheritdoc} + */ public function adminSummary() { // Set up $this->valueOptions for the parent summary $this->valueOptions = []; diff --git a/core/modules/user/src/Plugin/views/filter/Permissions.php b/core/modules/user/src/Plugin/views/filter/Permissions.php index d0add56d04ae419392fb4e5d40ab65334fa68ace..e4b2e449c27bc8a9e187fd4bf2f55ff100ab96ba 100644 --- a/core/modules/user/src/Plugin/views/filter/Permissions.php +++ b/core/modules/user/src/Plugin/views/filter/Permissions.php @@ -77,6 +77,9 @@ public static function create(ContainerInterface $container, array $configuratio ); } + /** + * {@inheritdoc} + */ public function getValueOptions() { if (!isset($this->valueOptions)) { $permissions = $this->permissionHandler->getPermissions(); diff --git a/core/modules/views/src/Plugin/views/filter/BooleanOperator.php b/core/modules/views/src/Plugin/views/filter/BooleanOperator.php index fd7ffd683b5411b5cd3c746b520c7c377fb8d6f9..9be5da4916716196eb7be814d4f135c334229b2d 100644 --- a/core/modules/views/src/Plugin/views/filter/BooleanOperator.php +++ b/core/modules/views/src/Plugin/views/filter/BooleanOperator.php @@ -178,6 +178,9 @@ public function getValueOptions() { return $this->valueOptions; } + /** + * {@inheritdoc} + */ protected function defineOptions() { $options = parent::defineOptions(); @@ -186,6 +189,9 @@ protected function defineOptions() { return $options; } + /** + * {@inheritdoc} + */ protected function valueForm(&$form, FormStateInterface $form_state) { $form['value'] = []; @@ -242,12 +248,18 @@ protected function valueForm(&$form, FormStateInterface $form_state) { } } + /** + * {@inheritdoc} + */ protected function valueValidate($form, FormStateInterface $form_state) { if ($form_state->getValue(['options', 'value']) == 'All' && !$form_state->isValueEmpty(['options', 'expose', 'required'])) { $form_state->setErrorByName('value', $this->t('You must select a value unless this is an non-required exposed filter.')); } } + /** + * {@inheritdoc} + */ public function adminSummary() { if ($this->isAGroup()) { return $this->t('grouped'); @@ -270,6 +282,9 @@ public function adminSummary() { return $this->operator; } + /** + * {@inheritdoc} + */ public function defaultExposeOptions() { parent::defaultExposeOptions(); $this->options['expose']['operator_id'] = ''; diff --git a/core/modules/views/src/Plugin/views/filter/BooleanOperatorString.php b/core/modules/views/src/Plugin/views/filter/BooleanOperatorString.php index b662aafa5f159c235404f073c3304713ad0752ea..fe97b21a02b2f91fef721b35304296dd602990c5 100644 --- a/core/modules/views/src/Plugin/views/filter/BooleanOperatorString.php +++ b/core/modules/views/src/Plugin/views/filter/BooleanOperatorString.php @@ -18,6 +18,9 @@ #[ViewsFilter("boolean_string")] class BooleanOperatorString extends BooleanOperator { + /** + * {@inheritdoc} + */ public function query() { $this->ensureMyTable(); $where = "$this->tableAlias.$this->realField "; diff --git a/core/modules/views/src/Plugin/views/filter/Combine.php b/core/modules/views/src/Plugin/views/filter/Combine.php index d4c622e0e79435058d8b73ef07d927528eb51809..7da1d6bef71dd715b4516fee4ce9db9d878811ff 100644 --- a/core/modules/views/src/Plugin/views/filter/Combine.php +++ b/core/modules/views/src/Plugin/views/filter/Combine.php @@ -18,6 +18,9 @@ class Combine extends StringFilter { */ public $query; + /** + * {@inheritdoc} + */ protected function defineOptions() { $options = parent::defineOptions(); $options['fields'] = ['default' => []]; @@ -25,6 +28,9 @@ protected function defineOptions() { return $options; } + /** + * {@inheritdoc} + */ public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); $this->view->initStyle(); @@ -55,6 +61,9 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { } } + /** + * {@inheritdoc} + */ public function query() { $this->view->_build('field'); $fields = []; @@ -138,6 +147,9 @@ public function opEqual($expression) { $this->query->addWhereExpression($this->options['group'], "$expression $operator $placeholder", [$placeholder => $this->value]); } + /** + * {@inheritdoc} + */ protected function opContains($expression) { $placeholder = $this->placeholder(); $operator = $this->getConditionOperator('LIKE'); @@ -178,42 +190,63 @@ protected function opContainsWord($expression) { } } + /** + * {@inheritdoc} + */ protected function opStartsWith($expression) { $placeholder = $this->placeholder(); $operator = $this->getConditionOperator('LIKE'); $this->query->addWhereExpression($this->options['group'], "$expression $operator $placeholder", [$placeholder => $this->connection->escapeLike($this->value) . '%']); } + /** + * {@inheritdoc} + */ protected function opNotStartsWith($expression) { $placeholder = $this->placeholder(); $operator = $this->getConditionOperator('NOT LIKE'); $this->query->addWhereExpression($this->options['group'], "$expression $operator $placeholder", [$placeholder => $this->connection->escapeLike($this->value) . '%']); } + /** + * {@inheritdoc} + */ protected function opEndsWith($expression) { $placeholder = $this->placeholder(); $operator = $this->getConditionOperator('LIKE'); $this->query->addWhereExpression($this->options['group'], "$expression $operator $placeholder", [$placeholder => '%' . $this->connection->escapeLike($this->value)]); } + /** + * {@inheritdoc} + */ protected function opNotEndsWith($expression) { $placeholder = $this->placeholder(); $operator = $this->getConditionOperator('NOT LIKE'); $this->query->addWhereExpression($this->options['group'], "$expression $operator $placeholder", [$placeholder => '%' . $this->connection->escapeLike($this->value)]); } + /** + * {@inheritdoc} + */ protected function opNotLike($expression) { $placeholder = $this->placeholder(); $operator = $this->getConditionOperator('NOT LIKE'); $this->query->addWhereExpression($this->options['group'], "$expression $operator $placeholder", [$placeholder => '%' . $this->connection->escapeLike($this->value) . '%']); } + /** + * {@inheritdoc} + */ protected function opRegex($expression) { $placeholder = $this->placeholder(); $operator = $this->getConditionOperator('REGEXP'); $this->query->addWhereExpression($this->options['group'], "$expression $operator $placeholder", [$placeholder => $this->value]); } + /** + * {@inheritdoc} + */ protected function opEmpty($expression) { if ($this->operator == 'empty') { $operator = "IS NULL"; diff --git a/core/modules/views/src/Plugin/views/filter/Date.php b/core/modules/views/src/Plugin/views/filter/Date.php index 84d776c4b64a65e7cc1d97c478fd0c3ab2347c5e..60b90b37c4ee8b221077c9f44d535edeab15cff0 100644 --- a/core/modules/views/src/Plugin/views/filter/Date.php +++ b/core/modules/views/src/Plugin/views/filter/Date.php @@ -13,6 +13,9 @@ #[ViewsFilter("date")] class Date extends NumericFilter { + /** + * {@inheritdoc} + */ protected function defineOptions() { $options = parent::defineOptions(); @@ -40,6 +43,9 @@ protected function valueForm(&$form, FormStateInterface $form_state) { parent::valueForm($form, $form_state); } + /** + * {@inheritdoc} + */ public function validateOptionsForm(&$form, FormStateInterface $form_state) { parent::validateOptionsForm($form, $form_state); @@ -51,6 +57,9 @@ public function validateOptionsForm(&$form, FormStateInterface $form_state) { $this->validateValidTime($form['value'], $form_state, $form_state->getValue(['options', 'operator']), $form_state->getValue(['options', 'value'])); } + /** + * {@inheritdoc} + */ public function validateExposed(&$form, FormStateInterface $form_state) { if (empty($this->options['exposed'])) { return; @@ -116,6 +125,9 @@ protected function hasValidGroupedValue(array $group) { return $actual == $expected; } + /** + * {@inheritdoc} + */ public function acceptExposedInput($input) { if (empty($this->options['exposed'])) { return TRUE; @@ -165,6 +177,9 @@ public function acceptExposedInput($input) { return $rc; } + /** + * {@inheritdoc} + */ protected function opBetween($field) { $a = intval(strtotime($this->value['min'], 0)); $b = intval(strtotime($this->value['max'], 0)); @@ -181,6 +196,9 @@ protected function opBetween($field) { $this->query->addWhereExpression($this->options['group'], "$field $operator $a AND $b"); } + /** + * {@inheritdoc} + */ protected function opSimple($field) { $value = intval(strtotime($this->value['value'], 0)); if (!empty($this->value['type']) && $this->value['type'] == 'offset') { diff --git a/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php b/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php index 21c4a81a725997bedf2d441318cda7be0be31a17..35197e155cf29cfb2513b59ee3707102b0662048 100644 --- a/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php +++ b/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php @@ -151,6 +151,9 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$ } } + /** + * {@inheritdoc} + */ protected function defineOptions() { $options = parent::defineOptions(); @@ -1645,6 +1648,9 @@ public function acceptExposedInput($input) { return TRUE; } + /** + * {@inheritdoc} + */ public function storeExposedInput($input, $status) { if (empty($this->options['exposed']) || empty($this->options['expose']['identifier'])) { return TRUE; diff --git a/core/modules/views/src/Plugin/views/filter/GroupByNumeric.php b/core/modules/views/src/Plugin/views/filter/GroupByNumeric.php index d05c8f7d6b3dd2689cc74850922cba74963bedb8..e9f813554538bc54b28eb59f8dbbd86eccf4ec4b 100644 --- a/core/modules/views/src/Plugin/views/filter/GroupByNumeric.php +++ b/core/modules/views/src/Plugin/views/filter/GroupByNumeric.php @@ -12,6 +12,9 @@ #[ViewsFilter("groupby_numeric")] class GroupByNumeric extends NumericFilter { + /** + * {@inheritdoc} + */ public function query() { $this->ensureMyTable(); $field = $this->getField(); @@ -22,6 +25,9 @@ public function query() { } } + /** + * {@inheritdoc} + */ protected function opBetween($field) { $placeholder_min = $this->placeholder(); $placeholder_max = $this->placeholder(); @@ -34,11 +40,17 @@ protected function opBetween($field) { } } + /** + * {@inheritdoc} + */ protected function opSimple($field) { $placeholder = $this->placeholder(); $this->query->addHavingExpression($this->options['group'], "$field $this->operator $placeholder", [$placeholder => $this->value['value']]); } + /** + * {@inheritdoc} + */ protected function opEmpty($field) { if ($this->operator == 'empty') { $operator = "IS NULL"; @@ -50,10 +62,16 @@ protected function opEmpty($field) { $this->query->addHavingExpression($this->options['group'], "$field $operator"); } + /** + * {@inheritdoc} + */ public function adminLabel($short = FALSE) { return $this->getField(parent::adminLabel($short)); } + /** + * {@inheritdoc} + */ public function canGroup() { return FALSE; } diff --git a/core/modules/views/src/Plugin/views/filter/InOperator.php b/core/modules/views/src/Plugin/views/filter/InOperator.php index 36089e05aec8a22a48ea7aef2509c4e5c87fc977..44df0fe22be1b8e13cf79c034b5454db3af36cf9 100644 --- a/core/modules/views/src/Plugin/views/filter/InOperator.php +++ b/core/modules/views/src/Plugin/views/filter/InOperator.php @@ -80,11 +80,17 @@ public function getValueOptions() { return $this->valueOptions; } + /** + * {@inheritdoc} + */ public function defaultExposeOptions() { parent::defaultExposeOptions(); $this->options['expose']['reduce'] = FALSE; } + /** + * {@inheritdoc} + */ public function buildExposeForm(&$form, FormStateInterface $form_state) { parent::buildExposeForm($form, $form_state); $form['expose']['reduce'] = [ @@ -96,6 +102,9 @@ public function buildExposeForm(&$form, FormStateInterface $form_state) { ]; } + /** + * {@inheritdoc} + */ protected function defineOptions() { $options = parent::defineOptions(); @@ -159,6 +168,9 @@ public function operatorOptions($which = 'title') { return $options; } + /** + * Gets the operators that have a given number of values. + */ protected function operatorValues($values = 1) { $options = []; foreach ($this->operators() as $id => $info) { @@ -170,6 +182,9 @@ protected function operatorValues($values = 1) { return $options; } + /** + * {@inheritdoc} + */ protected function valueForm(&$form, FormStateInterface $form_state) { $form['value'] = []; $options = []; @@ -307,6 +322,9 @@ public function acceptExposedInput($input) { return parent::acceptExposedInput($input); } + /** + * {@inheritdoc} + */ protected function valueSubmit($form, FormStateInterface $form_state) { // Drupal's FAPI system automatically puts '0' in for any checkbox that // was not set, and the key to the checkbox if it is set. @@ -320,6 +338,9 @@ protected function valueSubmit($form, FormStateInterface $form_state) { $form_state->setValue(['options', 'value'], $form['value']['#value']); } + /** + * {@inheritdoc} + */ public function adminSummary() { if ($this->isAGroup()) { return $this->t('grouped'); @@ -384,6 +405,9 @@ public function adminSummary() { return $operator . (($values !== '') ? ' ' . $values : ''); } + /** + * {@inheritdoc} + */ public function query() { $info = $this->operators(); if (!empty($info[$this->operator]['method'])) { @@ -391,6 +415,9 @@ public function query() { } } + /** + * Filters by a simple operator. + */ protected function opSimple() { if (empty($this->value)) { return; @@ -402,6 +429,9 @@ protected function opSimple() { $this->query->addWhere($this->options['group'], "$this->tableAlias.$this->realField", array_values($this->value), $this->operator); } + /** + * Filters by operator 'empty'. + */ protected function opEmpty() { $this->ensureMyTable(); if ($this->operator == 'empty') { @@ -414,6 +444,9 @@ protected function opEmpty() { $this->query->addWhere($this->options['group'], "$this->tableAlias.$this->realField", NULL, $operator); } + /** + * {@inheritdoc} + */ public function validate() { $this->getValueOptions(); $errors = parent::validate(); diff --git a/core/modules/views/src/Plugin/views/filter/ManyToOne.php b/core/modules/views/src/Plugin/views/filter/ManyToOne.php index f4049573b6acdd194370a0a3d8920da26cf6b105..61cbab958cc6618c37080bc85cf51de2f67f5a30 100644 --- a/core/modules/views/src/Plugin/views/filter/ManyToOne.php +++ b/core/modules/views/src/Plugin/views/filter/ManyToOne.php @@ -38,6 +38,9 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$ $this->helper = new ManyToOneHelper($this); } + /** + * {@inheritdoc} + */ protected function defineOptions() { $options = parent::defineOptions(); @@ -108,6 +111,9 @@ public function operators() { protected $valueFormType = 'select'; + /** + * {@inheritdoc} + */ protected function valueForm(&$form, FormStateInterface $form_state) { parent::valueForm($form, $form_state); @@ -129,6 +135,9 @@ public function ensureMyTable() { return parent::ensureMyTable(); } + /** + * Adds a filter. + */ protected function opHelper() { if (empty($this->value)) { return; diff --git a/core/modules/views/src/Plugin/views/filter/NumericFilter.php b/core/modules/views/src/Plugin/views/filter/NumericFilter.php index 1acda0990412bb3928ba6b7f10fe02978db486f2..4ef05d3823a8b27421bc75988189f8ad082278b3 100644 --- a/core/modules/views/src/Plugin/views/filter/NumericFilter.php +++ b/core/modules/views/src/Plugin/views/filter/NumericFilter.php @@ -15,6 +15,9 @@ class NumericFilter extends FilterPluginBase implements FilterOperatorsInterface protected $alwaysMultiple = TRUE; + /** + * {@inheritdoc} + */ protected function defineOptions() { $options = parent::defineOptions(); @@ -189,6 +192,9 @@ public function operatorOptions($which = 'title') { return $options; } + /** + * Gets the operators that have a given number of values. + */ protected function operatorValues($values = 1) { $options = []; foreach ($this->operators() as $id => $info) { @@ -330,6 +336,9 @@ protected function valueForm(&$form, FormStateInterface $form_state) { } } + /** + * {@inheritdoc} + */ public function query() { $this->ensureMyTable(); $field = "$this->tableAlias.$this->realField"; @@ -361,10 +370,16 @@ protected function opBetween($field) { } } + /** + * Filters by a simple operator. + */ protected function opSimple($field) { $this->query->addWhere($this->options['group'], $field, $this->value['value'], $this->operator); } + /** + * Adds a where clause for the operation, 'EMPTY'. + */ protected function opEmpty($field) { if ($this->operator == 'empty') { $operator = "IS NULL"; @@ -396,6 +411,9 @@ protected function opNotRegex($field) { $this->query->addWhere($this->options['group'], $field, $this->value['value'], 'NOT REGEXP'); } + /** + * {@inheritdoc} + */ public function adminSummary() { if ($this->isAGroup()) { return $this->t('grouped'); diff --git a/core/modules/views/src/Plugin/views/filter/StringFilter.php b/core/modules/views/src/Plugin/views/filter/StringFilter.php index fb6c55cb4413aa5e0321b0a2b3b1e4e6cbb858c7..a647cedf8336823ea6a29b9f6cc7090f74230f7a 100644 --- a/core/modules/views/src/Plugin/views/filter/StringFilter.php +++ b/core/modules/views/src/Plugin/views/filter/StringFilter.php @@ -65,6 +65,9 @@ public static function create(ContainerInterface $container, array $configuratio ); } + /** + * {@inheritdoc} + */ protected function defineOptions() { $options = parent::defineOptions(); @@ -219,6 +222,9 @@ public function operatorOptions($which = 'title') { return $options; } + /** + * {@inheritdoc} + */ public function adminSummary() { if ($this->isAGroup()) { return $this->t('grouped'); @@ -238,6 +244,9 @@ public function adminSummary() { return $output; } + /** + * Gets the operators that have a given number of values. + */ protected function operatorValues($values = 1) { $options = []; foreach ($this->operators() as $id => $info) { @@ -357,11 +366,17 @@ public function opEqual($field) { $this->query->addWhere($this->options['group'], $field, $this->value, $this->operator()); } + /** + * Adds a where clause for the operation, 'LIKE'. + */ protected function opContains($field) { $operator = $this->getConditionOperator('LIKE'); $this->query->addWhere($this->options['group'], $field, '%' . $this->connection->escapeLike($this->value) . '%', $operator); } + /** + * Adds a where clause for the operation, 'contains'. + */ protected function opContainsWord($field) { $where = $this->operator == 'word' ? $this->query->getConnection()->condition('OR') : $this->query->getConnection()->condition('AND'); @@ -395,31 +410,49 @@ protected function opContainsWord($field) { $this->query->addWhere($this->options['group'], $where); } + /** + * Adds a where clause for the operation, 'starts with'. + */ protected function opStartsWith($field) { $operator = $this->getConditionOperator('LIKE'); $this->query->addWhere($this->options['group'], $field, $this->connection->escapeLike($this->value) . '%', $operator); } + /** + * Adds a where clause for the operation, 'not starts with'. + */ protected function opNotStartsWith($field) { $operator = $this->getConditionOperator('NOT LIKE'); $this->query->addWhere($this->options['group'], $field, $this->connection->escapeLike($this->value) . '%', $operator); } + /** + * Adds a where clause for the operation, 'ends with'. + */ protected function opEndsWith($field) { $operator = $this->getConditionOperator('LIKE'); $this->query->addWhere($this->options['group'], $field, '%' . $this->connection->escapeLike($this->value), $operator); } + /** + * Adds a where clause for the operation, 'not ends with'. + */ protected function opNotEndsWith($field) { $operator = $this->getConditionOperator('NOT LIKE'); $this->query->addWhere($this->options['group'], $field, '%' . $this->connection->escapeLike($this->value), $operator); } + /** + * Adds a where clause for the operation, 'not LIKE'. + */ protected function opNotLike($field) { $operator = $this->getConditionOperator('NOT LIKE'); $this->query->addWhere($this->options['group'], $field, '%' . $this->connection->escapeLike($this->value) . '%', $operator); } + /** + * Adds a where clause for the operation, 'shorter than'. + */ protected function opShorterThan($field) { $placeholder = $this->placeholder(); // Type cast the argument to an integer because the SQLite database driver @@ -427,6 +460,9 @@ protected function opShorterThan($field) { $this->query->addWhereExpression($this->options['group'], "LENGTH($field) < $placeholder", [$placeholder => (int) $this->value]); } + /** + * Adds a where clause for the operation, 'longer than'. + */ protected function opLongerThan($field) { $placeholder = $this->placeholder(); // Type cast the argument to an integer because the SQLite database driver @@ -454,6 +490,9 @@ protected function opNotRegex($field) { $this->query->addWhere($this->options['group'], $field, $this->value, 'NOT REGEXP'); } + /** + * Adds a where clause for the operation, 'EMPTY'. + */ protected function opEmpty($field) { if ($this->operator == 'empty') { $operator = "IS NULL"; diff --git a/core/modules/views/tests/modules/views_test_data/src/Plugin/views/access/StaticTest.php b/core/modules/views/tests/modules/views_test_data/src/Plugin/views/access/StaticTest.php index f59c465da8c5e7728b2f639ca74422d2901a261e..6b0b0385fca635fc43506a9331d945022e096bea 100644 --- a/core/modules/views/tests/modules/views_test_data/src/Plugin/views/access/StaticTest.php +++ b/core/modules/views/tests/modules/views_test_data/src/Plugin/views/access/StaticTest.php @@ -20,6 +20,9 @@ )] class StaticTest extends AccessPluginBase { + /** + * {@inheritdoc} + */ protected function defineOptions() { $options = parent::defineOptions(); $options['access'] = ['default' => FALSE]; diff --git a/core/phpcs.xml.dist b/core/phpcs.xml.dist index 733c8d5084eaaaa96447d3c900ed569e8e648e31..b8a478e7120a176f5d83623c0190e2c2f4cf90c1 100644 --- a/core/phpcs.xml.dist +++ b/core/phpcs.xml.dist @@ -74,6 +74,11 @@ <exclude name="Drupal.Commenting.FunctionComment.ParamCommentFullStop"/> <exclude name="Drupal.Commenting.FunctionComment.TypeHintMissing"/> </rule> + <rule ref="Drupal.Commenting.FunctionComment.Missing"> + <include-pattern>core/modules/*/Plugin/views/filter/*</include-pattern> + <exclude-pattern>*/tests/*</exclude-pattern> + </rule> + <rule ref="Drupal.Commenting.FunctionComment.MissingParamType"> <include-pattern>core/lib/Component/*</include-pattern> </rule>