You are here

function simple_mobile_menu_build_tree in Simple Mobile Menu 8

Same name and namespace in other branches
  1. 8.2 simple_mobile_menu.module \simple_mobile_menu_build_tree()

Parameters

array $config:

Return value

mixed

1 call to simple_mobile_menu_build_tree()
SimpleMenuBlock::build in src/Plugin/Block/SimpleMenuBlock.php
Builds and returns the renderable array for this block plugin.

File

./simple_mobile_menu.module, line 54
Contains simple_mobile_menu.module

Code

function simple_mobile_menu_build_tree(array $config) {
  $menu_tree = \Drupal::service('simple_mobile_menu.menu_tree');
  $parameters = new MenuTreeParameters();

  // print_r($config);
  $tree = $menu_tree
    ->load($config[1], $parameters);
  $manipulators = array(
    array(
      'callable' => 'menu.default_tree_manipulators:checkAccess',
    ),
    array(
      'callable' => 'menu.default_tree_manipulators:generateIndexAndSort',
    ),
  );
  $tree = $menu_tree
    ->transform($tree, $manipulators);
  return $menu_tree
    ->build($tree);
}