You are here

class ToolbarMenuPermissions in Toolbar Menu 8

Same name and namespace in other branches
  1. 8.2 src/ToolbarMenuPermissions.php \Drupal\toolbar_menu\ToolbarMenuPermissions

Provides dynamic permissions of the toolbar_menu module.

Hierarchy

Expanded class hierarchy of ToolbarMenuPermissions

File

src/ToolbarMenuPermissions.php, line 11

Namespace

Drupal\toolbar_menu
View source
class ToolbarMenuPermissions implements ContainerInjectionInterface {

  /**
   * The toolbar menu manager.
   *
   * @var \Drupal\toolbar_menu\ToolbarMenuManager
   */
  protected $toolbarMenuManager;

  /**
   * Constructs a new ToolbarMenuPermissions instance.
   *
   * @param \Drupal\toolbar_menu\ToolbarMenuManager $toolbar_menu
   *   The toolbar menu manager.
   */
  public function __construct(ToolbarMenuManager $toolbar_menu) {
    $this->toolbarMenuManager = $toolbar_menu;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container) {
    return new static($container
      ->get('toolbar_menu.manager'));
  }

  /**
   * Returns an array of toolbar_menu permissions.
   *
   * @return array
   *   The permission list.
   */
  public function permissions() {
    return $this->toolbarMenuManager
      ->getPermissionList();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ToolbarMenuPermissions::$toolbarMenuManager protected property The toolbar menu manager.
ToolbarMenuPermissions::create public static function Instantiates a new instance of this class. Overrides ContainerInjectionInterface::create
ToolbarMenuPermissions::permissions public function Returns an array of toolbar_menu permissions.
ToolbarMenuPermissions::__construct public function Constructs a new ToolbarMenuPermissions instance.