X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fworkspaces%2Fworkspaces.module;h=8f4f2fa2e281a6ae0ca6353a2463c3cb2471e2dc;hp=f279c4389375284519a6d2f52ce0d5d15bda3331;hb=1c1cb0980bfa6caf0c24cce671b6bb541dc87583;hpb=9424afc6c1f518c301bf87a23c047d1873435d05 diff --git a/web/core/modules/workspaces/workspaces.module b/web/core/modules/workspaces/workspaces.module index f279c4389..8f4f2fa2e 100644 --- a/web/core/modules/workspaces/workspaces.module +++ b/web/core/modules/workspaces/workspaces.module @@ -56,6 +56,15 @@ function workspaces_form_alter(&$form, FormStateInterface $form_state, $form_id) ->formAlter($form, $form_state, $form_id); } +/** + * Implements hook_field_info_alter(). + */ +function workspaces_field_info_alter(&$definitions) { + \Drupal::service('class_resolver') + ->getInstanceFromDefinition(EntityTypeInfo::class) + ->fieldInfoAlter($definitions); +} + /** * Implements hook_entity_load(). */ @@ -154,15 +163,15 @@ function workspaces_toolbar() { $current_user = \Drupal::currentUser(); if (!$current_user->hasPermission('administer workspaces') - || !$current_user->hasPermission('view own workspace') - || !$current_user->hasPermission('view any workspace')) { + && !$current_user->hasPermission('view own workspace') + && !$current_user->hasPermission('view any workspace')) { return $items; } /** @var \Drupal\workspaces\WorkspaceInterface $active_workspace */ $active_workspace = \Drupal::service('workspaces.manager')->getActiveWorkspace(); - $items['workspace'] = [ + $items['workspace'] += [ '#type' => 'toolbar_item', 'tab' => [ '#type' => 'link', @@ -180,6 +189,7 @@ function workspaces_toolbar() { ], ]), ], + '#cache' => ['tags' => $active_workspace->getCacheTags()], ], '#wrapper_attributes' => [ 'class' => ['workspaces-toolbar-tab'],