Version 1
[yaffs-website] / web / core / modules / system / tests / modules / link_generation_test / link_generation_test.module
diff --git a/web/core/modules/system/tests/modules/link_generation_test/link_generation_test.module b/web/core/modules/system/tests/modules/link_generation_test/link_generation_test.module
new file mode 100644 (file)
index 0000000..622a403
--- /dev/null
@@ -0,0 +1,21 @@
+<?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>';
+    }
+  }
+}