You are here

public function SinglePageSiteManager::getMenuChildren in Single Page Site 8

Same name and namespace in other branches
  1. 2.x src/Manager/SinglePageSiteManager.php \Drupal\single_page_site\Manager\SinglePageSiteManager::getMenuChildren()
  2. 2.0.x src/Manager/SinglePageSiteManager.php \Drupal\single_page_site\Manager\SinglePageSiteManager::getMenuChildren()

Fetches all children of given menu.

Return value

array|\Drupal\Core\Menu\MenuLinkTreeElement[]|mixed Returns array with Menu Children values.

File

src/Manager/SinglePageSiteManager.php, line 209

Class

SinglePageSiteManager
Class SinglePageSiteManager.

Namespace

Drupal\single_page_site\Manager

Code

public function getMenuChildren() {

  // Set options.
  $parameters = new MenuTreeParameters();
  $parameters
    ->onlyEnabledLinks();

  // Load tree.
  $tree = $this->menuTree
    ->load($this
    ->getMenu(), $parameters);
  $manipulators = array(
    array(
      'callable' => 'menu.default_tree_manipulators:generateIndexAndSort',
    ),
  );
  return $this->menuTree
    ->transform($tree, $manipulators);
}