You are here

protected function MenuSelectTreeBuilder::generateMenuLink in Menu Select 8

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

Generates a link for menu items in the tree.

Parameters

string $menu_label: The menu label.

string $menu_key: The menu key of the link.

Return value

array The renderable array for a link.

1 call to MenuSelectTreeBuilder::generateMenuLink()
MenuSelectTreeBuilder::buildRenderedMenu in src/MenuSelectTreeBuilder.php
Builds a renderable array of the given menu tree.

File

src/MenuSelectTreeBuilder.php, line 152

Class

MenuSelectTreeBuilder
A service for building out the menu trees used in menu select.

Namespace

Drupal\menu_select

Code

protected function generateMenuLink($menu_label, $menu_key) {
  return [
    '#markup' => new FormattableMarkup('<a data-mkey="@mkey" class="menu-select-menu-link js-menu-select-menu-link" href="#menu-select-parent-menu">@title</a>', [
      '@title' => sprintf('%s (%s)', $menu_label, t('menu')),
      '@mkey' => $menu_key,
    ]),
  ];
}