class VocabularyVid in Drupal 10
Same name and namespace in other branches
- 8 core/modules/taxonomy/src/Plugin/views/argument/VocabularyVid.php \Drupal\taxonomy\Plugin\views\argument\VocabularyVid
- 9 core/modules/taxonomy/src/Plugin/views/argument/VocabularyVid.php \Drupal\taxonomy\Plugin\views\argument\VocabularyVid
Argument handler to accept a vocabulary id.
Plugin annotation
@ViewsArgument("vocabulary_vid");
Hierarchy
- class \Drupal\views\Plugin\views\argument\NumericArgument extends \Drupal\views\Plugin\views\argument\ArgumentPluginBase
- class \Drupal\taxonomy\Plugin\views\argument\VocabularyVid
Expanded class hierarchy of VocabularyVid
File
- core/
modules/ taxonomy/ src/ Plugin/ views/ argument/ VocabularyVid.php, line 16
Namespace
Drupal\taxonomy\Plugin\views\argumentView source
class VocabularyVid extends NumericArgument {
/**
* The vocabulary storage.
*
* @var \Drupal\taxonomy\VocabularyStorageInterface
*/
protected $vocabularyStorage;
/**
* Constructs the VocabularyVid object.
*
* @param array $configuration
* A configuration array containing information about the plugin instance.
* @param string $plugin_id
* The plugin_id for the plugin instance.
* @param mixed $plugin_definition
* The plugin implementation definition.
* @param \Drupal\taxonomy\VocabularyStorageInterface $vocabulary_storage
* The vocabulary storage.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, VocabularyStorageInterface $vocabulary_storage) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->vocabularyStorage = $vocabulary_storage;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container
->get('entity_type.manager')
->getStorage('taxonomy_vocabulary'));
}
/**
* Override the behavior of title(). Get the name of the vocabulary.
*/
public function title() {
$vocabulary = $this->vocabularyStorage
->load($this->argument);
if ($vocabulary) {
return $vocabulary
->label();
}
return $this
->t('No vocabulary');
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
NumericArgument:: |
public | property | The actual value which is used for querying. | |
NumericArgument:: |
public | function | 1 | |
NumericArgument:: |
protected | function | 1 | |
NumericArgument:: |
public | function | ||
NumericArgument:: |
public | function | ||
NumericArgument:: |
public | function | 1 | |
NumericArgument:: |
public | function | Override for specific title lookups. | 4 |
VocabularyVid:: |
protected | property | The vocabulary storage. | |
VocabularyVid:: |
public static | function | ||
VocabularyVid:: |
public | function |
Override the behavior of title(). Get the name of the vocabulary. Overrides NumericArgument:: |
|
VocabularyVid:: |
public | function | Constructs the VocabularyVid object. |