link_generation_test.module

Same filename and directory in other branches
  1. 9 core/modules/system/tests/modules/link_generation_test/link_generation_test.module
  2. 8.9.x core/modules/system/tests/modules/link_generation_test/link_generation_test.module
  3. 10 core/modules/system/tests/modules/link_generation_test/link_generation_test.module

Helper module for the link generation tests.

File

core/modules/system/tests/modules/link_generation_test/link_generation_test.module

View 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

Title Deprecated Summary
link_generation_test_link_alter Implements hook_link_alter().

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.