5 * Support module for user hooks testing.
8 use Drupal\Component\Render\FormattableMarkup;
9 use Drupal\Core\Session\AccountInterface;
12 * Implements hook_user_format_name_alter().
14 function user_hooks_test_user_format_name_alter(&$name, AccountInterface $account) {
15 if (\Drupal::state()->get('user_hooks_test_user_format_name_alter', FALSE)) {
16 if (\Drupal::state()->get('user_hooks_test_user_format_name_alter_safe', FALSE)) {
17 $name = new FormattableMarkup('<em>@uid</em>', ['@uid' => $account->id()]);
20 $name = '<em>' . $account->id() . '</em>';