private function SiteHeaderBlock::buildUserDropdownMenu in Opigno dashboard 3.x
Prepare the user dropdown menu.
Parameters
\Drupal\Core\StringTranslation\TranslatableMarkup $role: The user role.
Return value
array The array to build the user dropdown menu.
1 call to SiteHeaderBlock::buildUserDropdownMenu()
- SiteHeaderBlock::build in src/
Plugin/ Block/ SiteHeaderBlock.php - Builds and returns the renderable array for this block plugin.
File
- src/
Plugin/ Block/ SiteHeaderBlock.php, line 216
Class
- SiteHeaderBlock
- The site header block.
Namespace
Drupal\opigno_dashboard\Plugin\BlockCode
private function buildUserDropdownMenu(TranslatableMarkup $role) : array {
if (!$this->user instanceof UserInterface) {
return [];
}
return [
'name' => Link::createFromRoute($this->user
->getDisplayName(), 'entity.user.canonical', [
'user' => (int) $this->user
->id(),
]),
'role' => $role,
'is_admin' => $this->user
->hasPermission('access administration pages'),
'links' => [
'help' => [
'title' => $this
->t('Help'),
'path' => 'https://www.opigno.org/contact',
'external' => TRUE,
'icon_class' => 'fi-rr-interrogation',
],
'review' => [
'title' => $this
->t('Review Opigno'),
'path' => 'https://reviews.capterra.com/new/135113?utm_source=vp&utm_medium=none&utm_term=&utm_content=&utm_campaign=vendor_request',
'external' => TRUE,
'icon_class' => 'fi-rr-comment',
],
'logout' => [
'title' => $this
->t('Logout'),
'path' => Url::fromRoute('user.logout')
->toString(),
'icon_class' => 'fi-rr-sign-out',
],
],
];
}