You are here

function taxonomy_facets_get_menu_tree in Taxonomy Facets 8

Same name and namespace in other branches
  1. 7.3 taxonomy_facets.module \taxonomy_facets_get_menu_tree()
  2. 7.2 taxonomy_facets.module \taxonomy_facets_get_menu_tree()

Print out menu tree for each vocab selected to be taxo faceted filter.

For each vocabulary id that is passed as an argument output menu tree. Array of menu tree is passed through the theme function at the end, so themed output is produced.

Parameters

integer $vid: Vocabulary id

Return value

string Themed menu tree.

5 calls to taxonomy_facets_get_menu_tree()
TaxonomyFacetsBlock1::build in src/Plugin/Block/TaxonomyFacetsBlock1.php
Builds and returns the renderable array for this block plugin.
TaxonomyFacetsBlock2::build in src/Plugin/Block/TaxonomyFacetsBlock2.php
Builds and returns the renderable array for this block plugin.
TaxonomyFacetsBlock3::build in src/Plugin/Block/TaxonomyFacetsBlock3.php
Builds and returns the renderable array for this block plugin.
TaxonomyFacetsBlock4::build in src/Plugin/Block/TaxonomyFacetsBlock4.php
Builds and returns the renderable array for this block plugin.
TaxonomyFacetsBlock5::build in src/Plugin/Block/TaxonomyFacetsBlock5.php
Builds and returns the renderable array for this block plugin.

File

./taxonomy_facets.module, line 16

Code

function taxonomy_facets_get_menu_tree($vocab_name) {
  $menu = new \Drupal\taxonomy_facets\MenuTree($vocab_name);
  $menu_tree = $menu
    ->getMenuTree();

  // Render the menu
  $menu_items = null;
  foreach ($menu_tree as $item) {
    $menu_items .= render($item);
  }
  return $menu_items;
}