user_hooks_test.module in Zircon Profile 8.0
Same filename and directory in other branches
Support module for user hooks testing.
File
core/modules/user/tests/modules/user_hooks_test/user_hooks_test.moduleView source
<?php
/**
* @file
* Support module for user hooks testing.
*/
use Drupal\Component\Utility\SafeMarkup;
/**
* Implements hook_user_format_name_alter().
*/
function user_hooks_test_user_format_name_alter(&$name, $account) {
if (\Drupal::state()
->get('user_hooks_test_user_format_name_alter', FALSE)) {
if (\Drupal::state()
->get('user_hooks_test_user_format_name_alter_safe', FALSE)) {
$name = SafeMarkup::format('<em>@uid</em>', array(
'@uid' => $account
->id(),
));
}
else {
$name = '<em>' . $account
->id() . '</em>';
}
}
}
Functions
Name | Description |
---|---|
user_hooks_test_user_format_name_alter | Implements hook_user_format_name_alter(). |