private function PageContext::getVocabularyTermNames in Acquia Lift Connector 8
Same name and namespace in other branches
- 8.4 src/Service/Context/PageContext.php \Drupal\acquia_lift\Service\Context\PageContext::getVocabularyTermNames()
- 8.3 src/Service/Context/PageContext.php \Drupal\acquia_lift\Service\Context\PageContext::getVocabularyTermNames()
Get Vocabularies' Term names.
Parameters
\Drupal\Core\Entity\EntityInterface $node: Node.
Return value
array Vocabularies' Term names.
1 call to PageContext::getVocabularyTermNames()
- PageContext::setFields in src/
Service/ Context/ PageContext.php - Set fields.
File
- src/
Service/ Context/ PageContext.php, line 194 - Contains \Drupal\acquia_lift\Service\Context\PageContext.
Class
Namespace
Drupal\acquia_lift\Service\ContextCode
private function getVocabularyTermNames(EntityInterface $node) {
// Find the node's terms.
$terms = $this->taxonomyTermStorage
->getNodeTerms([
$node
->id(),
]);
$node_terms = isset($terms[$node
->id()]) ? $terms[$node
->id()] : [];
// Find the term names.
$vocabulary_term_names = [];
foreach ($node_terms as $term) {
$vocabulary_id = $term
->getVocabularyId();
$term_name = $term
->getName();
$vocabulary_term_names[$vocabulary_id][] = $term_name;
}
return $vocabulary_term_names;
}