private function HierarchicalTaxonomyMenuBlock::getStatusFromTid in Hierarchical Taxonomy Menu 8
Gets term status.
1 call to HierarchicalTaxonomyMenuBlock::getStatusFromTid()
- HierarchicalTaxonomyMenuBlock::build in src/
Plugin/ Block/ HierarchicalTaxonomyMenuBlock.php - Builds and returns the renderable array for this block plugin.
File
- src/
Plugin/ Block/ HierarchicalTaxonomyMenuBlock.php, line 682
Class
- HierarchicalTaxonomyMenuBlock
- Provides a 'HierarchicalTaxonomyMenuBlock' block.
Namespace
Drupal\hierarchical_taxonomy_menu\Plugin\BlockCode
private function getStatusFromTid($tid) {
$language = $this->languageManager
->getCurrentLanguage()
->getId();
if (isset(self::$terms[$tid])) {
$term = self::$terms[$tid];
}
else {
$term = $this->entityTypeManager
->getStorage('taxonomy_term')
->load($tid);
self::$terms[$tid] = $term;
}
$translation_languages = $term
->getTranslationLanguages();
if (isset($translation_languages[$language])) {
$term_translated = $term
->getTranslation($language);
return $term_translated->status->value;
}
return $term->status->value;
}