taxonomy_vocabulary_get_names

taxonomy_vocabulary_get_names()

Get names for all taxonomy vocabularies.

Return value

array A list of existing vocabulary IDs.

File

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

Code

function taxonomy_vocabulary_get_names() {
  $names = &drupal_static(__FUNCTION__);

  if (!isset($names)) {
    $names = array();
    $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;
}
doc_Drupal
2016-10-29 09:46:34
Comments
Leave a Comment

Please login to continue.