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\faqCode
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);
}