You are here

public function ToolbarMenuManager::getToolbarMenuElements in Toolbar Menu 8.2

Same name and namespace in other branches
  1. 8 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 50

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;
}