Skip to content
Snippets Groups Projects

Issue #3342457: Configure link is displayed even if user does not have the appropriate permission

Merged Issue #3342457: Configure link is displayed even if user does not have the appropriate permission
1 file
+ 11
8
Compare changes
  • Side-by-side
  • Inline
+ 11
8
@@ -160,14 +160,6 @@ class ToolbarHandler implements ContainerInjectionInterface {
],
'tray' => [
'#heading' => $this->t('Environments menu'),
'configuration' => [
'#type' => 'link',
'#title' => $this->t('Configure'),
'#url' => Url::fromRoute('environment_indicator.settings'),
'#options' => [
'attributes' => ['class' => ['edit-environments']],
],
],
],
'#attached' => [
'library' => ['environment_indicator/drupal.environment_indicator'],
@@ -182,6 +174,17 @@ class ToolbarHandler implements ContainerInjectionInterface {
]
];
if ($this->account->hasPermission('administer environment indicator settings')) {
$items['environment_indicator']['tray']['configuration'] = [
'#type' => 'link',
'#title' => $this->t('Configure'),
'#url' => Url::fromRoute('environment_indicator.settings'),
'#options' => [
'attributes' => ['class' => ['edit-environments']],
],
];
}
if ($links = $this->getLinks()) {
$items['environment_indicator']['tray']['environment_links'] = [
'#theme' => 'links__toolbar_shortcuts',
Loading