public function TaxonomyMenu::renderTaxonomyLinks in Zircon Profile 8
Same name and namespace in other branches
- 8.0 modules/taxonomy_menu/src/Controller/TaxonomyMenu.php \Drupal\taxonomy_menu\Controller\TaxonomyMenu::renderTaxonomyLinks()
Render taxonomy links.
Return value
string Return Hello string.
1 string reference to 'TaxonomyMenu::renderTaxonomyLinks'
- taxonomy_menu.routing.yml in modules/
taxonomy_menu/ taxonomy_menu.routing.yml - modules/taxonomy_menu/taxonomy_menu.routing.yml
File
- modules/
taxonomy_menu/ src/ Controller/ TaxonomyMenu.php, line 28 - Contains Drupal\taxonomy_menu\Controller\TaxonomyMenu.
Class
- TaxonomyMenu
- Class TaxonomyMenu.
Namespace
Drupal\taxonomy_menu\ControllerCode
public function renderTaxonomyLinks() {
$markup = '';
/*
// Check current main menu.
$menu_tree = \Drupal::menuTree();
$parameters = new MenuTreeParameters();
$tree = $menu_tree->load('main', $parameters);
$markup .= var_export($tree, TRUE);
*/
// Load taxonomy menus.
$storage = \Drupal::entityManager()
->getStorage('taxonomy_menu');
$taxonomy_menus = $storage
->loadMultiple();
$links = [];
// Get taxonomy and create menu links from vocabularies.
foreach ($taxonomy_menus as $taxonomy_menu) {
$links += $taxonomy_menu
->generateTaxonomyLinks([]);
}
//$markup .= var_export($links, TRUE);
return [
'#type' => 'markup',
'#markup' => $this
->t($markup),
];
}