MenuController::getParentOptions

public MenuController::getParentOptions(Request $request)

Gets all the available menus and menu items as a JavaScript array.

Parameters

\Symfony\Component\HttpFoundation\Request $request: The request of the page.

Return value

\Symfony\Component\HttpFoundation\JsonResponse The available menu and menu items.

File

core/modules/menu_ui/src/Controller/MenuController.php, line 51

Class

MenuController
Returns responses for Menu routes.

Namespace

Drupal\menu_ui\Controller

Code

public function getParentOptions(Request $request) {
  $available_menus = array();
  if ($menus = $request->request->get('menus')) {
    foreach ($menus as $menu) {
      $available_menus[$menu] = $menu;
    }
  }
  // @todo Update this to use the optional $cacheability parameter, so that
  //   a cacheable JSON response can be sent.
  $options = $this->menuParentSelector->getParentSelectOptions('', $available_menus);

  return new JsonResponse($options);
}
doc_Drupal
2016-10-29 09:26:09
Comments
Leave a Comment

Please login to continue.