You are here

protected function CshsFormatterBase::getTermParents in Client-side Hierarchical Select 8

Same name and namespace in other branches
  1. 8.3 src/Plugin/Field/FieldFormatter/CshsFormatterBase.php \Drupal\cshs\Plugin\Field\FieldFormatter\CshsFormatterBase::getTermParents()
  2. 8.2 src/Plugin/Field/FieldFormatter/CshsFormatterBase.php \Drupal\cshs\Plugin\Field\FieldFormatter\CshsFormatterBase::getTermParents()

Returns an array of all parents for a given term.

Parameters

\Drupal\taxonomy\TermInterface $term: The taxonomy term.

Return value

TermInterface[] The parent terms of a given term.

2 calls to CshsFormatterBase::getTermParents()
CshsFullHierarchyFormatter::viewElements in src/Plugin/Field/FieldFormatter/CshsFullHierarchyFormatter.php
Builds a renderable array for a field value.
CshsGroupByRootFormatter::viewElements in src/Plugin/Field/FieldFormatter/CshsGroupByRootFormatter.php
Builds a renderable array for a field value.

File

src/Plugin/Field/FieldFormatter/CshsFormatterBase.php, line 100

Class

CshsFormatterBase
Base formatter for CSHS field.

Namespace

Drupal\cshs\Plugin\Field\FieldFormatter

Code

protected function getTermParents(TermInterface $term) : array {
  return \array_reverse($this
    ->getTermStorage()
    ->loadAllParents($term
    ->id()));
}