Skip to content
Snippets Groups Projects
Verified Commit 4c387375 authored by Théodore Biadala's avatar Théodore Biadala
Browse files

Issue #3491513 by quietone, smustgrave: Fix...

Issue #3491513 by quietone, smustgrave: Fix Drupal.Commenting.FunctionComment.Missing in views argument plugins
parent b450cb38
No related branches found
No related tags found
2 merge requests!11197Issue #3506427 by eduardo morales alberti: Remove responsive_image.ajax from hook,!10223132456: Fix issue where views instances are emptied before an ajax request is complete
Pipeline #411043 passed with warnings
Pipeline: drupal

#411049

    Pipeline: drupal

    #411045

      Showing
      with 121 additions and 0 deletions
      ...@@ -51,6 +51,9 @@ public static function create(ContainerInterface $container, array $configuratio ...@@ -51,6 +51,9 @@ public static function create(ContainerInterface $container, array $configuratio
      return new static($configuration, $plugin_id, $plugin_definition, $container->get('database')); return new static($configuration, $plugin_id, $plugin_definition, $container->get('database'));
      } }
      /**
      * {@inheritdoc}
      */
      public function title() { public function title() {
      if (!$this->argument) { if (!$this->argument) {
      $title = \Drupal::config('user.settings')->get('anonymous'); $title = \Drupal::config('user.settings')->get('anonymous');
      ...@@ -65,6 +68,9 @@ public function title() { ...@@ -65,6 +68,9 @@ public function title() {
      return $title; return $title;
      } }
      /**
      * {@inheritdoc}
      */
      protected function defaultActions($which = NULL) { protected function defaultActions($which = NULL) {
      // Disallow summary views on this argument. // Disallow summary views on this argument.
      if (!$which) { if (!$which) {
      ...@@ -79,6 +85,9 @@ protected function defaultActions($which = NULL) { ...@@ -79,6 +85,9 @@ protected function defaultActions($which = NULL) {
      } }
      } }
      /**
      * {@inheritdoc}
      */
      public function query($group_by = FALSE) { public function query($group_by = FALSE) {
      $this->ensureMyTable(); $this->ensureMyTable();
      ......
      ...@@ -67,6 +67,9 @@ public function title() { ...@@ -67,6 +67,9 @@ public function title() {
      return $this->node_type($this->argument); return $this->node_type($this->argument);
      } }
      /**
      * Returns the label for the given node type.
      */
      public function node_type($type_name) { public function node_type($type_name) {
      $type = $this->nodeTypeStorage->load($type_name); $type = $this->nodeTypeStorage->load($type_name);
      $output = $type ? $type->label() : $this->t('Unknown content type'); $output = $type ? $type->label() : $this->t('Unknown content type');
      ......
      ...@@ -15,6 +15,9 @@ ...@@ -15,6 +15,9 @@
      )] )]
      class UidRevision extends Uid { class UidRevision extends Uid {
      /**
      * {@inheritdoc}
      */
      public function query($group_by = FALSE) { public function query($group_by = FALSE) {
      $this->ensureMyTable(); $this->ensureMyTable();
      $placeholder = $this->placeholder(); $placeholder = $this->placeholder();
      ......
      ...@@ -16,6 +16,9 @@ ...@@ -16,6 +16,9 @@
      )] )]
      class IndexTid extends ManyToOne { class IndexTid extends ManyToOne {
      /**
      * {@inheritdoc}
      */
      public function titleQuery() { public function titleQuery() {
      $titles = []; $titles = [];
      $terms = Term::loadMultiple($this->value); $terms = Term::loadMultiple($this->value);
      ......
      ...@@ -43,6 +43,9 @@ public static function create(ContainerInterface $container, array $configuratio ...@@ -43,6 +43,9 @@ public static function create(ContainerInterface $container, array $configuratio
      ); );
      } }
      /**
      * {@inheritdoc}
      */
      protected function defineOptions() { protected function defineOptions() {
      $options = parent::defineOptions(); $options = parent::defineOptions();
      ...@@ -53,6 +56,9 @@ protected function defineOptions() { ...@@ -53,6 +56,9 @@ protected function defineOptions() {
      return $options; return $options;
      } }
      /**
      * {@inheritdoc}
      */
      public function buildOptionsForm(&$form, FormStateInterface $form_state) { public function buildOptionsForm(&$form, FormStateInterface $form_state) {
      $form['depth'] = [ $form['depth'] = [
      '#type' => 'weight', '#type' => 'weight',
      ...@@ -89,6 +95,9 @@ protected function defaultActions($which = NULL) { ...@@ -89,6 +95,9 @@ protected function defaultActions($which = NULL) {
      return $actions; return $actions;
      } }
      /**
      * {@inheritdoc}
      */
      public function query($group_by = FALSE) { public function query($group_by = FALSE) {
      $this->ensureMyTable(); $this->ensureMyTable();
      ...@@ -106,6 +115,9 @@ public function query($group_by = FALSE) { ...@@ -106,6 +115,9 @@ public function query($group_by = FALSE) {
      $this->addSubQueryJoin($tids); $this->addSubQueryJoin($tids);
      } }
      /**
      * {@inheritdoc}
      */
      public function title() { public function title() {
      $term = $this->entityRepository->getCanonical('taxonomy_term', $this->argument); $term = $this->entityRepository->getCanonical('taxonomy_term', $this->argument);
      if (!empty($term)) { if (!empty($term)) {
      ......
      ...@@ -19,10 +19,19 @@ ...@@ -19,10 +19,19 @@
      )] )]
      class IndexTidDepthModifier extends ArgumentPluginBase { class IndexTidDepthModifier extends ArgumentPluginBase {
      /**
      * {@inheritdoc}
      */
      public function buildOptionsForm(&$form, FormStateInterface $form_state) {} public function buildOptionsForm(&$form, FormStateInterface $form_state) {}
      /**
      * {@inheritdoc}
      */
      public function query($group_by = FALSE) {} public function query($group_by = FALSE) {}
      /**
      * {@inheritdoc}
      */
      public function preQuery() { public function preQuery() {
      // We don't know our argument yet, but it's based upon our position: // We don't know our argument yet, but it's based upon our position:
      $argument = $this->view->args[$this->position] ?? NULL; $argument = $this->view->args[$this->position] ?? NULL;
      ......
      ...@@ -157,6 +157,9 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$ ...@@ -157,6 +157,9 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$
      } }
      } }
      /**
      * Checks if the argument has an exception.
      */
      public function isException($arg = NULL) { public function isException($arg = NULL) {
      if (!isset($arg)) { if (!isset($arg)) {
      $arg = $this->argument ?? NULL; $arg = $this->argument ?? NULL;
      ...@@ -164,6 +167,9 @@ public function isException($arg = NULL) { ...@@ -164,6 +167,9 @@ public function isException($arg = NULL) {
      return !empty($this->options['exception']['value']) && $this->options['exception']['value'] === $arg; return !empty($this->options['exception']['value']) && $this->options['exception']['value'] === $arg;
      } }
      /**
      * Returns the title of the exception for the argument.
      */
      public function exceptionTitle() { public function exceptionTitle() {
      // If title overriding is off for the exception, return the normal title. // If title overriding is off for the exception, return the normal title.
      if (empty($this->options['exception']['title_enable'])) { if (empty($this->options['exception']['title_enable'])) {
      ...@@ -183,6 +189,9 @@ public function needsStylePlugin() { ...@@ -183,6 +189,9 @@ public function needsStylePlugin() {
      return !empty($info['style plugin']) || !empty($validate_info['style plugin']); return !empty($info['style plugin']) || !empty($validate_info['style plugin']);
      } }
      /**
      * {@inheritdoc}
      */
      protected function defineOptions() { protected function defineOptions() {
      $options = parent::defineOptions(); $options = parent::defineOptions();
      ...@@ -227,6 +236,9 @@ public static function trustedCallbacks() { ...@@ -227,6 +236,9 @@ public static function trustedCallbacks() {
      return $callbacks; return $callbacks;
      } }
      /**
      * {@inheritdoc}
      */
      public function buildOptionsForm(&$form, FormStateInterface $form_state) { public function buildOptionsForm(&$form, FormStateInterface $form_state) {
      parent::buildOptionsForm($form, $form_state); parent::buildOptionsForm($form, $form_state);
      ...@@ -476,6 +488,9 @@ protected function getTokenHelp() { ...@@ -476,6 +488,9 @@ protected function getTokenHelp() {
      return $output; return $output;
      } }
      /**
      * {@inheritdoc}
      */
      public function validateOptionsForm(&$form, FormStateInterface $form_state) { public function validateOptionsForm(&$form, FormStateInterface $form_state) {
      $option_values = &$form_state->getValue('options'); $option_values = &$form_state->getValue('options');
      if (empty($option_values)) { if (empty($option_values)) {
      ...@@ -506,6 +521,9 @@ public function validateOptionsForm(&$form, FormStateInterface $form_state) { ...@@ -506,6 +521,9 @@ public function validateOptionsForm(&$form, FormStateInterface $form_state) {
      } }
      /**
      * {@inheritdoc}
      */
      public function submitOptionsForm(&$form, FormStateInterface $form_state) { public function submitOptionsForm(&$form, FormStateInterface $form_state) {
      $option_values = &$form_state->getValue('options'); $option_values = &$form_state->getValue('options');
      if (empty($option_values)) { if (empty($option_values)) {
      ......
      ...@@ -40,6 +40,9 @@ public function title() { ...@@ -40,6 +40,9 @@ public function title() {
      return $this->dateFormatter->format(strtotime("2005" . "05" . $day . " 00:00:00 UTC"), 'custom', $this->format, 'UTC'); return $this->dateFormatter->format(strtotime("2005" . "05" . $day . " 00:00:00 UTC"), 'custom', $this->format, 'UTC');
      } }
      /**
      * {@inheritdoc}
      */
      public function summaryArgument($data) { public function summaryArgument($data) {
      // Make sure the argument contains leading zeroes. // Make sure the argument contains leading zeroes.
      return str_pad($data->{$this->base_alias}, 2, '0', STR_PAD_LEFT); return str_pad($data->{$this->base_alias}, 2, '0', STR_PAD_LEFT);
      ......
      ...@@ -37,6 +37,9 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$ ...@@ -37,6 +37,9 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$
      } }
      } }
      /**
      * Gets the prepared formula.
      */
      public function getFormula() { public function getFormula() {
      return str_replace('***table***', $this->tableAlias, $this->formula); return str_replace('***table***', $this->tableAlias, $this->formula);
      } }
      ......
      ...@@ -14,6 +14,9 @@ ...@@ -14,6 +14,9 @@
      )] )]
      class GroupByNumeric extends ArgumentPluginBase { class GroupByNumeric extends ArgumentPluginBase {
      /**
      * {@inheritdoc}
      */
      public function query($group_by = FALSE) { public function query($group_by = FALSE) {
      $this->ensureMyTable(); $this->ensureMyTable();
      $field = $this->getField(); $field = $this->getField();
      ...@@ -22,6 +25,9 @@ public function query($group_by = FALSE) { ...@@ -22,6 +25,9 @@ public function query($group_by = FALSE) {
      $this->query->addHavingExpression(0, "$field = $placeholder", [$placeholder => $this->argument]); $this->query->addHavingExpression(0, "$field = $placeholder", [$placeholder => $this->argument]);
      } }
      /**
      * {@inheritdoc}
      */
      public function adminLabel($short = FALSE) { public function adminLabel($short = FALSE) {
      return $this->getField(parent::adminLabel($short)); return $this->getField(parent::adminLabel($short));
      } }
      ......
      ...@@ -46,6 +46,9 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$ ...@@ -46,6 +46,9 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$
      $this->value = []; $this->value = [];
      } }
      /**
      * {@inheritdoc}
      */
      protected function defineOptions() { protected function defineOptions() {
      $options = parent::defineOptions(); $options = parent::defineOptions();
      ...@@ -65,6 +68,9 @@ protected function defineOptions() { ...@@ -65,6 +68,9 @@ protected function defineOptions() {
      return $options; return $options;
      } }
      /**
      * {@inheritdoc}
      */
      public function buildOptionsForm(&$form, FormStateInterface $form_state) { public function buildOptionsForm(&$form, FormStateInterface $form_state) {
      parent::buildOptionsForm($form, $form_state); parent::buildOptionsForm($form, $form_state);
      ...@@ -102,6 +108,9 @@ public function ensureMyTable() { ...@@ -102,6 +108,9 @@ public function ensureMyTable() {
      $this->helper->ensureMyTable(); $this->helper->ensureMyTable();
      } }
      /**
      * {@inheritdoc}
      */
      public function query($group_by = FALSE) { public function query($group_by = FALSE) {
      $empty = FALSE; $empty = FALSE;
      if (isset($this->definition['zero is null']) && $this->definition['zero is null']) { if (isset($this->definition['zero is null']) && $this->definition['zero is null']) {
      ...@@ -132,6 +141,9 @@ public function query($group_by = FALSE) { ...@@ -132,6 +141,9 @@ public function query($group_by = FALSE) {
      $this->helper->addFilter(); $this->helper->addFilter();
      } }
      /**
      * {@inheritdoc}
      */
      public function title() { public function title() {
      if (!$this->argument) { if (!$this->argument) {
      return !empty($this->definition['empty field name']) ? $this->definition['empty field name'] : $this->t('Uncategorized'); return !empty($this->definition['empty field name']) ? $this->definition['empty field name'] : $this->t('Uncategorized');
      ...@@ -159,6 +171,9 @@ public function title() { ...@@ -159,6 +171,9 @@ public function title() {
      return implode($this->operator == 'or' ? ' + ' : ', ', $this->titleQuery()); return implode($this->operator == 'or' ? ' + ' : ', ', $this->titleQuery());
      } }
      /**
      * {@inheritdoc}
      */
      protected function summaryQuery() { protected function summaryQuery() {
      $field = $this->table . '.' . $this->field; $field = $this->table . '.' . $this->field;
      $join = $this->getJoin(); $join = $this->getJoin();
      ...@@ -182,6 +197,9 @@ protected function summaryQuery() { ...@@ -182,6 +197,9 @@ protected function summaryQuery() {
      return $this->summaryBasics(); return $this->summaryBasics();
      } }
      /**
      * {@inheritdoc}
      */
      public function summaryArgument($data) { public function summaryArgument($data) {
      $value = $data->{$this->base_alias}; $value = $data->{$this->base_alias};
      if (empty($value)) { if (empty($value)) {
      ......
      ...@@ -48,6 +48,9 @@ public function title() { ...@@ -48,6 +48,9 @@ public function title() {
      } }
      } }
      /**
      * {@inheritdoc}
      */
      public function summaryArgument($data) { public function summaryArgument($data) {
      // Make sure the argument contains leading zeroes. // Make sure the argument contains leading zeroes.
      return str_pad($data->{$this->base_alias}, 2, '0', STR_PAD_LEFT); return str_pad($data->{$this->base_alias}, 2, '0', STR_PAD_LEFT);
      ......
      ...@@ -15,6 +15,9 @@ ...@@ -15,6 +15,9 @@
      )] )]
      class NullArgument extends ArgumentPluginBase { class NullArgument extends ArgumentPluginBase {
      /**
      * {@inheritdoc}
      */
      protected function defineOptions() { protected function defineOptions() {
      $options = parent::defineOptions(); $options = parent::defineOptions();
      $options['must_not_be'] = ['default' => FALSE]; $options['must_not_be'] = ['default' => FALSE];
      ......
      ...@@ -25,6 +25,9 @@ class NumericArgument extends ArgumentPluginBase { ...@@ -25,6 +25,9 @@ class NumericArgument extends ArgumentPluginBase {
      */ */
      public $value; public $value;
      /**
      * {@inheritdoc}
      */
      protected function defineOptions() { protected function defineOptions() {
      $options = parent::defineOptions(); $options = parent::defineOptions();
      ...@@ -34,6 +37,9 @@ protected function defineOptions() { ...@@ -34,6 +37,9 @@ protected function defineOptions() {
      return $options; return $options;
      } }
      /**
      * {@inheritdoc}
      */
      public function buildOptionsForm(&$form, FormStateInterface $form_state) { public function buildOptionsForm(&$form, FormStateInterface $form_state) {
      parent::buildOptionsForm($form, $form_state); parent::buildOptionsForm($form, $form_state);
      ...@@ -55,6 +61,9 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ...@@ -55,6 +61,9 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
      ]; ];
      } }
      /**
      * {@inheritdoc}
      */
      public function title() { public function title() {
      if (!$this->argument) { if (!$this->argument) {
      return !empty($this->definition['empty field name']) ? $this->definition['empty field name'] : $this->t('Uncategorized'); return !empty($this->definition['empty field name']) ? $this->definition['empty field name'] : $this->t('Uncategorized');
      ...@@ -91,6 +100,9 @@ public function titleQuery() { ...@@ -91,6 +100,9 @@ public function titleQuery() {
      return $this->value; return $this->value;
      } }
      /**
      * {@inheritdoc}
      */
      public function query($group_by = FALSE) { public function query($group_by = FALSE) {
      $this->ensureMyTable(); $this->ensureMyTable();
      ......
      ...@@ -43,6 +43,9 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$ ...@@ -43,6 +43,9 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$
      } }
      } }
      /**
      * {@inheritdoc}
      */
      protected function defineOptions() { protected function defineOptions() {
      $options = parent::defineOptions(); $options = parent::defineOptions();
      ...@@ -61,6 +64,9 @@ protected function defineOptions() { ...@@ -61,6 +64,9 @@ protected function defineOptions() {
      return $options; return $options;
      } }
      /**
      * {@inheritdoc}
      */
      public function buildOptionsForm(&$form, FormStateInterface $form_state) { public function buildOptionsForm(&$form, FormStateInterface $form_state) {
      parent::buildOptionsForm($form, $form_state); parent::buildOptionsForm($form, $form_state);
      ...@@ -271,6 +277,9 @@ public function query($group_by = FALSE) { ...@@ -271,6 +277,9 @@ public function query($group_by = FALSE) {
      } }
      } }
      /**
      * {@inheritdoc}
      */
      public function summaryArgument($data) { public function summaryArgument($data) {
      $value = $this->caseTransform($data->{$this->base_alias}, $this->options['path_case']); $value = $this->caseTransform($data->{$this->base_alias}, $this->options['path_case']);
      if (!empty($this->options['transform_dash'])) { if (!empty($this->options['transform_dash'])) {
      ...@@ -286,6 +295,9 @@ public function getSortName() { ...@@ -286,6 +295,9 @@ public function getSortName() {
      return $this->t('Alphabetical', [], ['context' => 'Sort order']); return $this->t('Alphabetical', [], ['context' => 'Sort order']);
      } }
      /**
      * {@inheritdoc}
      */
      public function title() { public function title() {
      // Support case-insensitive title comparisons for PostgreSQL by converting // Support case-insensitive title comparisons for PostgreSQL by converting
      // the title to lowercase. // the title to lowercase.
      ...@@ -324,6 +336,9 @@ public function titleQuery() { ...@@ -324,6 +336,9 @@ public function titleQuery() {
      return $this->value; return $this->value;
      } }
      /**
      * {@inheritdoc}
      */
      public function summaryName($data) { public function summaryName($data) {
      return $this->caseTransform(parent::summaryName($data), $this->options['case']); return $this->caseTransform(parent::summaryName($data), $this->options['case']);
      } }
      ......
      ...@@ -70,6 +70,7 @@ ...@@ -70,6 +70,7 @@
      <exclude name="Drupal.Commenting.FunctionComment.TypeHintMissing"/> <exclude name="Drupal.Commenting.FunctionComment.TypeHintMissing"/>
      </rule> </rule>
      <rule ref="Drupal.Commenting.FunctionComment.Missing"> <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/filter/*</include-pattern>
      <include-pattern>core/modules/*/Plugin/views/access/*</include-pattern> <include-pattern>core/modules/*/Plugin/views/access/*</include-pattern>
      <include-pattern>core/modules/*/Plugin/views/cache/*</include-pattern> <include-pattern>core/modules/*/Plugin/views/cache/*</include-pattern>
      ......
      0% Loading or .
      You are about to add 0 people to the discussion. Proceed with caution.
      Finish editing this message first!
      Please register or to comment