You are here

private function MenuTree::buildMenyTreeHeader in Taxonomy Facets 8

1 call to MenuTree::buildMenyTreeHeader()
MenuTree::__construct in src/MenuTree.php

File

src/MenuTree.php, line 100

Class

MenuTree

Namespace

Drupal\taxonomy_facets

Code

private function buildMenyTreeHeader() {
  if ($this->termSelected) {
    $termObj = (object) [
      'name' => $this->termSelected
        ->getName(),
    ];
    $termObj->tid = $this->termSelected
      ->id();
    $termObj->vid = $this->termSelected
      ->getVocabularyId();
    $headItem = new MenuLeaf($termObj);

    // remove current filter from the url
    $headItem->linkUrl = str_replace('/' . $headItem->urlAlias, "", $headItem->linkUrl);
    $this->menuTree[] = [
      '#theme' => 'taxonomy_facets_remove_filter_template',
      '#menuHed' => $headItem,
    ];
  }
}