You are here

function taxonomy_vocabulary_get_names in Drupal 8

Same name and namespace in other branches
  1. 7 modules/taxonomy/taxonomy.module \taxonomy_vocabulary_get_names()
  2. 9 core/modules/taxonomy/taxonomy.module \taxonomy_vocabulary_get_names()

Get names for all taxonomy vocabularies.

Return value

array A list of existing vocabulary IDs.

5 calls to taxonomy_vocabulary_get_names()
NodeTermData::init in core/modules/taxonomy/src/Plugin/views/relationship/NodeTermData.php
Overrides \Drupal\views\Plugin\views\HandlerBase::init().
taxonomy_term_load_multiple_by_name in core/modules/taxonomy/taxonomy.module
Try to map a string to an existing term, as for glossary use.
Term::init in core/modules/taxonomy/src/Plugin/views/argument_validator/Term.php
Initialize the plugin.
Tid::init in core/modules/taxonomy/src/Plugin/views/argument_default/Tid.php
Initialize the plugin.
VocabularyCrudTest::testTaxonomyVocabularyLoadMultiple in core/modules/taxonomy/tests/src/Kernel/VocabularyCrudTest.php
Tests for loading multiple vocabularies.
1 string reference to 'taxonomy_vocabulary_get_names'
VocabularyStorage::resetCache in core/modules/taxonomy/src/VocabularyStorage.php
Resets the internal, static entity cache.

File

core/modules/taxonomy/taxonomy.module, line 330
Enables the organization of content into categories.

Code

function taxonomy_vocabulary_get_names() {
  $names =& drupal_static(__FUNCTION__);
  if (!isset($names)) {
    $names = [];
    $config_names = \Drupal::configFactory()
      ->listAll('taxonomy.vocabulary.');
    foreach ($config_names as $config_name) {
      $id = substr($config_name, strlen('taxonomy.vocabulary.'));
      $names[$id] = $id;
    }
  }
  return $names;
}