From efdf26ccc5bb8b71bab3f679dc6987646fd78eab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Garn=C3=A6s?= Date: Thu, 12 Oct 2023 10:01:16 +0200 Subject: [PATCH] Add "Logged in" suffix in the HTML head title when users are logged in This applies for all users - both patrons and library staff. This assumes that patrons will be logged in as both Drupal users and with Adgangsplatformen tokens as is currently the case. DDFLSBP-86 --- web/modules/custom/dpl_login/dpl_login.module | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/web/modules/custom/dpl_login/dpl_login.module b/web/modules/custom/dpl_login/dpl_login.module index 2f9aa4c56d..1ee76dcfbd 100644 --- a/web/modules/custom/dpl_login/dpl_login.module +++ b/web/modules/custom/dpl_login/dpl_login.module @@ -93,3 +93,12 @@ function _dpl_login_user_has_been_processed(array $openid_connect_context): bool // then we do not attach any information. return !$openid_connect_context['is_new'] ?? FALSE; } + +/** + * Implements hook_preprocess_html(). + */ +function dpl_login_preprocess_html(array &$variables): void { + if (\Drupal::currentUser()->isAuthenticated()) { + $variables['head_title'][] = t('Logged in', [], ['context' => 'dpl_login']); + } +}