You are here

protected function ToolbarSettingsForm::getLinkLabels in Devel 8.3

Same name and namespace in other branches
  1. 8 src/Form/ToolbarSettingsForm.php \Drupal\devel\Form\ToolbarSettingsForm::getLinkLabels()
  2. 8.2 src/Form/ToolbarSettingsForm.php \Drupal\devel\Form\ToolbarSettingsForm::getLinkLabels()
  3. 4.x src/Form/ToolbarSettingsForm.php \Drupal\devel\Form\ToolbarSettingsForm::getLinkLabels()

Provides an array of available menu items.

Return value

array Associative array of devel menu item labels keyed by plugin ID.

1 call to ToolbarSettingsForm::getLinkLabels()
ToolbarSettingsForm::buildForm in src/Form/ToolbarSettingsForm.php
Form constructor.

File

src/Form/ToolbarSettingsForm.php, line 101

Class

ToolbarSettingsForm
Configures devel toolbar settings.

Namespace

Drupal\devel\Form

Code

protected function getLinkLabels() {
  $options = [];
  $parameters = new MenuTreeParameters();
  $parameters
    ->onlyEnabledLinks()
    ->setTopLevelOnly();
  $tree = $this->menuLinkTree
    ->load('devel', $parameters);
  foreach ($tree as $element) {
    $link = $element->link;
    $options[$link
      ->getPluginId()] = $link
      ->getTitle();
  }
  asort($options);
  return $options;
}