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
      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();
      ......
      ......@@ -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');
      ......
      ......@@ -15,6 +15,9 @@
      )]
      class UidRevision extends Uid {
      /**
      * {@inheritdoc}
      */
      public function query($group_by = FALSE) {
      $this->ensureMyTable();
      $placeholder = $this->placeholder();
      ......
      ......@@ -16,6 +16,9 @@
      )]
      class IndexTid extends ManyToOne {
      /**
      * {@inheritdoc}
      */
      public function titleQuery() {
      $titles = [];
      $terms = Term::loadMultiple($this->value);
      ......
      ......@@ -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)) {
      ......
      ......@@ -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;
      ......
      ......@@ -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)) {
      ......
      ......@@ -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);
      ......
      ......@@ -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);
      }
      ......
      ......@@ -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));
      }
      ......
      ......@@ -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)) {
      ......
      ......@@ -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);
      ......
      ......@@ -15,6 +15,9 @@
      )]
      class NullArgument extends ArgumentPluginBase {
      /**
      * {@inheritdoc}
      */
      protected function defineOptions() {
      $options = parent::defineOptions();
      $options['must_not_be'] = ['default' => FALSE];
      ......
      ......@@ -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();
      ......
      ......@@ -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']);
      }
      ......
      ......@@ -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>
      ......
      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