link_generation_test.module in Drupal 10
Same filename and directory in other branches
Helper module for the link generation tests.
File
core/modules/system/tests/modules/link_generation_test/link_generation_test.moduleView source
<?php
/**
* @file
* Helper module for the link generation tests.
*/
/**
* Implements hook_link_alter().
*/
function link_generation_test_link_alter(&$variables) {
if (\Drupal::state()
->get('link_generation_test_link_alter', FALSE)) {
// Add a text to the end of links.
if (\Drupal::state()
->get('link_generation_test_link_alter_safe', FALSE)) {
$variables['text'] = t('@text <strong>Test!</strong>', [
'@text' => $variables['text'],
]);
}
else {
$variables['text'] .= ' <strong>Test!</strong>';
}
}
}
Functions
Name | Description |
---|---|
link_generation_test_link_alter | Implements hook_link_alter(). |