function user_hooks_test_user_format_name_alter
Same name in other branches
- 9 core/modules/user/tests/modules/user_hooks_test/user_hooks_test.module \user_hooks_test_user_format_name_alter()
- 10 core/modules/user/tests/modules/user_hooks_test/user_hooks_test.module \user_hooks_test_user_format_name_alter()
- 11.x core/modules/user/tests/modules/user_hooks_test/user_hooks_test.module \user_hooks_test_user_format_name_alter()
Implements hook_user_format_name_alter().
8 string references to 'user_hooks_test_user_format_name_alter'
- CommentAttributesTest::testCommentRdfaMarkup in core/
modules/ rdf/ tests/ src/ Functional/ CommentAttributesTest.php - Tests if RDFa markup for meta information is present in comments.
- CommentAttributesTest::testCommentRdfAuthorMarkup in core/
modules/ rdf/ tests/ src/ Functional/ CommentAttributesTest.php - Tests comment author link markup has not been broken by RDF.
- CommentPreviewTest::testCommentPreview in core/
modules/ comment/ tests/ src/ Functional/ CommentPreviewTest.php - Tests comment preview.
- TrackerTest::testTrackerUser in core/
modules/ tracker/ tests/ src/ Functional/ TrackerTest.php - Tests for the presence of nodes on a user's tracker listing.
- UserAttributesTest::setUp in core/
modules/ rdf/ tests/ src/ Functional/ UserAttributesTest.php
File
-
core/
modules/ user/ tests/ modules/ user_hooks_test/ user_hooks_test.module, line 14
Code
function user_hooks_test_user_format_name_alter(&$name, AccountInterface $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 = new FormattableMarkup('<em>@uid</em>', [
'@uid' => $account->id(),
]);
}
else {
$name = '<em>' . $account->id() . '</em>';
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.