You are here

protected function MenuSelectAutocompleteController::buildCandidateLinks in Menu Select 8

Same name and namespace in other branches
  1. 2.0.x src/Controller/MenuSelectAutocompleteController.php \Drupal\menu_select\Controller\MenuSelectAutocompleteController::buildCandidateLinks()

Build a recursive list of all candidates.

Parameters

array $tree: A menu tree.

string $menu_name: The menu name.

array $options: An array of options, built recurwsively.

1 call to MenuSelectAutocompleteController::buildCandidateLinks()
MenuSelectAutocompleteController::getMatchingLinks in src/Controller/MenuSelectAutocompleteController.php
Get links matching the given keyword.

File

src/Controller/MenuSelectAutocompleteController.php, line 90

Class

MenuSelectAutocompleteController
Defines a controller class with methods for auto complete.

Namespace

Drupal\menu_select\Controller

Code

protected function buildCandidateLinks(array $tree, $menu_name, array &$options) {
  foreach ($tree as $data) {
    $title = $data->link
      ->getTitle();
    $options[$menu_name . ':' . $data->link
      ->getPluginId()] = $title;
    if (!empty($data->subtree)) {
      $this
        ->buildCandidateLinks($data->subtree, $menu_name, $options);
    }
  }
}