Commit 5c291dd4 authored by Maxime Roux's avatar Maxime Roux Committed by Tijs De Boeck
Browse files

Issue #3258714: Manage attachments cache

parent 7b763042
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -17,6 +17,9 @@ function markerio_page_attachments(&$attachments) {

  $user = \Drupal::currentUser();

  $attachments['#cache']['contexts'][] = 'user';
  $attachments['#cache']['tags'][] = 'config:markerio.settings';

  if ($user->hasPermission('access markerio') && isset($destination)) {
    // Get username and e-mailaddress.
    $user_email = FALSE;
@@ -32,5 +35,7 @@ function markerio_page_attachments(&$attachments) {
    $attachments['#attached']['drupalSettings']['markerio']['destination'] = $destination;
    $attachments['#attached']['drupalSettings']['markerio']['user_email'] = $user_email;
    $attachments['#attached']['drupalSettings']['markerio']['user_name'] = $user_name;

    $attachments['#cache']['tags'][] = 'user:' . $user->id();
  }
}