Skip to content
Snippets Groups Projects
Commit 25d201bb authored by Liam Morland's avatar Liam Morland
Browse files

ISTWCMS-4636: Add "People" and "Reports" links to the toolbar under "Workbench"

parent 71706897
No related branches found
No related tags found
1 merge request!65ISTWCMS-4631, ISTWCMS-4636: Toolbar adjustments
......@@ -7,6 +7,7 @@
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
use Drupal\uw_cfg_common\Service\UWService;
use Drupal\webform\WebformInterface;
use Drupal\webform\WebformSubmissionStorageInterface;
......@@ -197,6 +198,22 @@ function uw_cfg_common_toolbar_alter(&$items) {
elseif (!UWService::userIsAdmin($current_user)) {
// Remove "Manage" toolbar item.
unset($items['administration']);
// Add links to "Workbench". 'dashboards' is renamed in
// uw_dashboard_toolbar_alter().
$links = [
'entity.user.collection' => t('People'),
'system.admin_reports' => t('Reports'),
];
foreach ($links as $route => $title) {
$url = Url::fromRoute($route);
if ($url->access()) {
$items['dashboards']['tray']['dashboards']['#items'][] = [
'#type' => 'link',
'#title' => $title,
'#url' => $url,
];
}
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment