You are here

private function ContentEntityCdfNormalizer::getVocabularyByName in Acquia Content Hub 8

Returns a vocabulary object which matches the given name.

Will return null if no such vocabulary exists.

Parameters

string $vocabulary_name: This is the name of the section which is required.

Return value

Object This is the vocabulary object with the name or null if no such vocabulary exists.

1 call to ContentEntityCdfNormalizer::getVocabularyByName()
ContentEntityCdfNormalizer::denormalize in src/Normalizer/ContentEntityCdfNormalizer.php
Denormalizes data back into an object of the given class.

File

src/Normalizer/ContentEntityCdfNormalizer.php, line 1483

Class

ContentEntityCdfNormalizer
Converts the Drupal entity object to a Acquia Content Hub CDF array.

Namespace

Drupal\acquia_contenthub\Normalizer

Code

private function getVocabularyByName($vocabulary_name) {
  $vocabs = Vocabulary::loadMultiple(NULL);
  foreach ($vocabs as $vocab_object) {

    /** @var \Drupal\taxonomy\Entity\Vocabulary $vocab_object  */
    if ($vocab_object
      ->getOriginalId() == $vocabulary_name) {
      return $vocab_object;
    }
  }
  return NULL;
}