Unverified Commit 26c6cd60 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3221149 by claudiu.cristea, tim.plunkett, guilhermevp, alexpott,...

Issue #3221149 by claudiu.cristea, tim.plunkett, guilhermevp, alexpott, andypost: Remove dead code in Taxonomy's Views handlers
parent df19e701
Loading
Loading
Loading
Loading
+0 −20
Changes for core/modules/taxonomy/src/Plugin/views/argument_default/Tid.php: 0 added lines, 20 removed lines.
Original line number Diff line number Diff line
@@ -7,8 +7,6 @@
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\taxonomy\TermInterface;
use Drupal\views\ViewExecutable;
use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\Plugin\views\argument_default\ArgumentDefaultPluginBase;
use Drupal\node\NodeInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -72,24 +70,6 @@ public static function create(ContainerInterface $container, array $configuratio
    );
  }

  /**
   * {@inheritdoc}
   */
  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
    parent::init($view, $display, $options);

    // @todo Remove the legacy code.
    // Convert legacy vids option to machine name vocabularies.
    if (!empty($this->options['vids'])) {
      $vocabularies = $this->vocabularyStorage->getQuery()->execute();
      foreach ($this->options['vids'] as $vid) {
        if (isset($vocabularies[$vid], $vocabularies[$vid]->machine_name)) {
          $this->options['vocabularies'][$vocabularies[$vid]->machine_name] = $vocabularies[$vid]->machine_name;
        }
      }
    }
  }

  /**
   * {@inheritdoc}
   */
+8 −23
Changes for core/modules/taxonomy/src/Plugin/views/argument_validator/Term.php: 8 added lines, 23 removed lines.
Original line number Diff line number Diff line
@@ -2,33 +2,18 @@

namespace Drupal\taxonomy\Plugin\views\argument_validator;

use Drupal\views\ViewExecutable;
use Drupal\views\Plugin\views\display\DisplayPluginBase;
@trigger_error('The ' . __NAMESPACE__ . '\Term is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Drupal\views\Plugin\views\argument_validator\Entity instead. See https://www.drupal.org/node/3221870', E_USER_DEPRECATED);

use Drupal\views\Plugin\views\argument_validator\Entity;

/**
 * Adds legacy vocabulary handling to standard Entity Argument validation..
 * Adds legacy vocabulary handling to standard Entity Argument validation.
 *
 * @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
 *   \Drupal\views\Plugin\views\argument_validator\Entity instead.
 *
 * @see https://www.drupal.org/node/3221870
 */
class Term extends Entity {

  /**
   * {@inheritdoc}
   */
  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
    parent::init($view, $display, $options);

    // @todo Remove the legacy code.
    // Convert legacy vids option to machine name vocabularies.
    if (!empty($this->options['vids'])) {
      $vocabularies = $this->entityTypeManager->getStorage('taxonomy_vocabulary')
        ->getQuery()
        ->execute();
      foreach ($this->options['vids'] as $vid) {
        if (isset($vocabularies[$vid], $vocabularies[$vid]->machine_name)) {
          $this->options['vocabularies'][$vocabularies[$vid]->machine_name] = $vocabularies[$vid]->machine_name;
        }
      }
    }
  }

}
+0 −20
Changes for core/modules/taxonomy/src/Plugin/views/relationship/NodeTermData.php: 0 added lines, 20 removed lines.
Original line number Diff line number Diff line
@@ -5,8 +5,6 @@
use Drupal\Core\Database\Database;
use Drupal\Core\Form\FormStateInterface;
use Drupal\taxonomy\VocabularyStorageInterface;
use Drupal\views\ViewExecutable;
use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\Plugin\views\relationship\RelationshipPluginBase;
use Symfony\Component\DependencyInjection\ContainerInterface;

@@ -55,24 +53,6 @@ public static function create(ContainerInterface $container, array $configuratio
    );
  }

  /**
   * {@inheritdoc}
   */
  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
    parent::init($view, $display, $options);

    // @todo Remove the legacy code.
    // Convert legacy vids option to machine name vocabularies.
    if (!empty($this->options['vids'])) {
      $vocabularies = $this->vocabularyStorage->getQuery()->execute();
      foreach ($this->options['vids'] as $vid) {
        if (isset($vocabularies[$vid], $vocabularies[$vid]->machine_name)) {
          $this->options['vocabularies'][$vocabularies[$vid]->machine_name] = $vocabularies[$vid]->machine_name;
        }
      }
    }
  }

  protected function defineOptions() {
    $options = parent::defineOptions();
    $options['vids'] = ['default' => []];
+7 −0
Changes for core/modules/taxonomy/taxonomy.post_update.php: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -18,3 +18,10 @@ function taxonomy_removed_post_updates() {
    'taxonomy_post_update_configure_status_field_widget' => '9.0.0',
  ];
}

/**
 * Clear the cache after deprecating Term views argument validator.
 */
function taxonomy_post_update_clear_views_argument_validator_plugins_cache(): void {
  // An empty update will flush all caches.
}
+0 −13
Changes for core/modules/taxonomy/taxonomy.views.inc: 0 added lines, 13 removed lines.
Original line number Diff line number Diff line
@@ -70,16 +70,3 @@ function taxonomy_field_views_data_alter(array &$data, FieldStorageConfigInterfa
    }
  }
}

/**
 * Implements hook_views_plugins_argument_validator_alter().
 *
 * Extend the generic entity argument validator.
 *
 * @see \Drupal\views\Plugin\views\argument_validator\Entity
 */
function taxonomy_views_plugins_argument_validator_alter(array &$plugins) {
  $plugins['entity:taxonomy_term']['title'] = t('Taxonomy term ID');
  $plugins['entity:taxonomy_term']['class'] = 'Drupal\taxonomy\Plugin\views\argument_validator\Term';
  $plugins['entity:taxonomy_term']['provider'] = 'taxonomy';
}
Loading