class LinkGenerationTestHooks
Hook implementations for link_generation_test.
Hierarchy
- class \Drupal\link_generation_test\Hook\LinkGenerationTestHooks
Expanded class hierarchy of LinkGenerationTestHooks
File
-
core/
modules/ system/ tests/ modules/ link_generation_test/ src/ Hook/ LinkGenerationTestHooks.php, line 12
Namespace
Drupal\link_generation_test\HookView source
class LinkGenerationTestHooks {
/**
* Implements hook_link_alter().
*/
public function linkAlter(&$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>';
}
}
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
LinkGenerationTestHooks::linkAlter | public | function | Implements hook_link_alter(). |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.