Skip to content

Commit

Permalink
Add "Logged in" suffix in the HTML head title when users are logged in
Browse files Browse the repository at this point in the history
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
  • Loading branch information
kasperg committed Oct 12, 2023
1 parent 5790c21 commit efdf26c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions web/modules/custom/dpl_login/dpl_login.module
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
}
}

0 comments on commit efdf26c

Please sign in to comment.