function userswitch_toolbar in User Switch 8
Implements hook_toolbar().
File
- ./
userswitch.module, line 24 - Contains userswitch.module.
Code
function userswitch_toolbar() {
$items = [];
if (\Drupal::service('userswitch')
->isSwitchUser()) {
$items['user_switch_back'] = [
'#type' => 'toolbar_item',
'tab' => [
'#type' => 'link',
'#title' => t('Back to Account'),
'#url' => Url::fromRoute('userswitch.backuser.switch'),
'#attributes' => [
'class' => [
'toolbar-icon',
'toolbar-icon-escape-admin',
],
],
],
'#weight' => -20,
];
}
return $items;
}