private function PageContext::getVocabularyTermNames in Acquia Lift Connector 8.3
Same name and namespace in other branches
- 8.4 src/Service/Context/PageContext.php \Drupal\acquia_lift\Service\Context\PageContext::getVocabularyTermNames()
- 8 src/Service/Context/PageContext.php \Drupal\acquia_lift\Service\Context\PageContext::getVocabularyTermNames()
Get Vocabularies' Term names.
Parameters
\Drupal\node\NodeInterface $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 336
Class
Namespace
Drupal\acquia_lift\Service\ContextCode
private function getVocabularyTermNames(NodeInterface $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
->bundle();
$term_name = $term
->getName();
$vocabulary_term_names[$vocabulary_id][] = $term_name;
}
return $vocabulary_term_names;
}