You are here

public function ToolbarMenuManager::getToolbarMenuElements in Toolbar Menu 8

Same name and namespace in other branches
  1. 8.2 src/ToolbarMenuManager.php \Drupal\toolbar_menu\ToolbarMenuManager::getToolbarMenuElements()

Get toolbar menu elements.

Return value

\Drupal\toolbar_menu\Entity\ToolbarMenuElement[] An array containing toolbar menu elements.

File

src/ToolbarMenuManager.php, line 58

Class

ToolbarMenuManager
Implement a setting form for toolbar_menu module.

Namespace

Drupal\toolbar_menu

Code

public function getToolbarMenuElements() {
  $elements = [];
  foreach ($this->toolbarMenuElements as $key => $element) {
    if ($this->account
      ->hasPermission($this
      ->getPermissionName($element))) {
      $elements[$key] = $element;
    }
  }
  return $elements;
}