Skip to content
Snippets Groups Projects
Commit 8d23ea40 authored by Matthew Slater's avatar Matthew Slater
Browse files

added clear => to the token replacement.

parent 10465f2e
No related branches found
No related tags found
No related merge requests found
...@@ -32,15 +32,16 @@ function alt_login_user_format_name_alter(&$name, $account) { ...@@ -32,15 +32,16 @@ function alt_login_user_format_name_alter(&$name, $account) {
if (!isset($names[$uid])) { if (!isset($names[$uid])) {
// Anonymous users // Anonymous users
if (\Drupal::currentUser()->isAnonymous()) { if (\Drupal::currentUser()->isAnonymous()) {
$anon = \Drupal::config('alt_login.settings')->get('display_anon');
$names[$uid] = \Drupal::token() $names[$uid] = \Drupal::token()
->replace(\Drupal::config('alt_login.settings')->get('display_anon'), ['user' => $account]); ->replace($anon, ['user' => $account], ['clear' => true]);
} }
// Do the replacement if the module is configured. // Do the replacement if the module is configured.
elseif ($template = \Drupal::config('alt_login.settings')->get('display')) { elseif ($template = \Drupal::config('alt_login.settings')->get('display')) {
if (!$account instanceof UserInterface) { if (!$account instanceof UserInterface) {
$account = User::load($account->id()); $account = User::load($account->id());
} }
$names[$uid] = \Drupal::token()->replace($template, ['user' => $account]); $names[$uid] = \Drupal::token()->replace($template, ['user' => $account], ['clear' => true]);
} }
// If the above didn't produce a string or isn't configured, fall back to the username. // If the above didn't produce a string or isn't configured, fall back to the username.
if (empty($names[$uid])) { if (empty($names[$uid])) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment