You are here

protected function DevelToolbarTest::getMenuLinkInfos in Devel 8

Same name and namespace in other branches
  1. 8.3 tests/src/Functional/DevelToolbarTest.php \Drupal\Tests\devel\Functional\DevelToolbarTest::getMenuLinkInfos()
  2. 8.2 tests/src/Functional/DevelToolbarTest.php \Drupal\Tests\devel\Functional\DevelToolbarTest::getMenuLinkInfos()
  3. 4.x tests/src/Functional/DevelToolbarTest.php \Drupal\Tests\devel\Functional\DevelToolbarTest::getMenuLinkInfos()

Helper function for retrieve the menu link informations.

Return value

array An array containing the menu link informations.

2 calls to DevelToolbarTest::getMenuLinkInfos()
DevelToolbarTest::testConfigurationForm in tests/src/Functional/DevelToolbarTest.php
Tests configuration form.
DevelToolbarTest::testToolbarIntegration in tests/src/Functional/DevelToolbarTest.php
Tests toolbar integration.

File

tests/src/Functional/DevelToolbarTest.php, line 252

Class

DevelToolbarTest
Tests devel toolbar module functionality.

Namespace

Drupal\Tests\devel\Functional

Code

protected function getMenuLinkInfos() {
  $parameters = new MenuTreeParameters();
  $parameters
    ->onlyEnabledLinks()
    ->setTopLevelOnly();
  $tree = \Drupal::menuTree()
    ->load('devel', $parameters);
  $links = [];
  foreach ($tree as $element) {
    $links[] = [
      'id' => $element->link
        ->getPluginId(),
      'title' => $element->link
        ->getTitle(),
      'url' => $element->link
        ->getUrlObject()
        ->toString(),
    ];
  }
  return $links;
}