Security update to Drupal 8.4.6
[yaffs-website] / web / core / modules / taxonomy / src / Plugin / views / argument_validator / Term.php
1 <?php
2
3 namespace Drupal\taxonomy\Plugin\views\argument_validator;
4
5 use Drupal\views\ViewExecutable;
6 use Drupal\views\Plugin\views\display\DisplayPluginBase;
7 use Drupal\views\Plugin\views\argument_validator\Entity;
8
9 /**
10  * Adds legacy vocabulary handling to standard Entity Argument validation..
11  */
12 class Term extends Entity {
13
14   /**
15    * {@inheritdoc}
16    */
17   public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
18     parent::init($view, $display, $options);
19
20     // @todo Remove the legacy code.
21     // Convert legacy vids option to machine name vocabularies.
22     if (!empty($this->options['vids'])) {
23       $vocabularies = taxonomy_vocabulary_get_names();
24       foreach ($this->options['vids'] as $vid) {
25         if (isset($vocabularies[$vid], $vocabularies[$vid]->machine_name)) {
26           $this->options['vocabularies'][$vocabularies[$vid]->machine_name] = $vocabularies[$vid]->machine_name;
27         }
28       }
29     }
30   }
31
32 }