You are here

public static function FaqHelper::faqRelatedVocabularies in Frequently Asked Questions 8

Returns an array containing the vocabularies related to the FAQ node type.

Return value

array Array containing the FAQ related vocabularies.

File

src/FaqHelper.php, line 209

Class

FaqHelper
Contains static helper functions for FAQ module.

Namespace

Drupal\faq

Code

public static function faqRelatedVocabularies() {
  $vids = array();
  foreach (\Drupal::entityTypeManager()
    ->getStorage('node')
    ->getFieldDefinitions('node', 'faq') as $field_definition) {
    if ($field_definition
      ->getType() == 'taxonomy_term_reference') {
      foreach ($field_definition
        ->getSetting('allowed_values') as $allowed_values) {
        $vids[] = $allowed_values['vocabulary'];
      }
    }
  }
  return Vocabulary::loadMultiple($vids);
}