function ToolbarSettingsForm::getLinkLabels

Same name in other branches
  1. 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 86

Class

ToolbarSettingsForm
Configures devel toolbar settings.

Namespace

Drupal\devel\Form

Code

protected function getLinkLabels() : array {
    $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;
}