hook_link_alter

function hook_link_alter

hook_link_alter(&$variables)

Alter the parameters for links.

Parameters

array $variables: An associative array of variables defining a link. The link may be either a "route link" using \Drupal\Core\Utility\LinkGenerator::link(), which is exposed as the 'link_generator' service or a link generated by \Drupal\Core\Utility\LinkGeneratorInterface::generate(). If the link is a "route link", 'route_name' will be set; otherwise, 'path' will be set. The following keys can be altered:

  • text: The link text for the anchor tag. If the hook implementation changes this text it needs to preserve the safeness of the original text. Using 登录查看完整内容