function template_preprocess_link_formatter_link_separate
Same name in other branches
- 9 core/modules/link/link.module \template_preprocess_link_formatter_link_separate()
- 8.9.x core/modules/link/link.module \template_preprocess_link_formatter_link_separate()
- 10 core/modules/link/link.module \template_preprocess_link_formatter_link_separate()
Prepares variables for separated link field templates.
This template outputs a separate title and link.
Default template: link-formatter-link-separate.html.twig.
Parameters
array $variables: An associative array containing:
- title: (optional) A descriptive or alternate title for the link, which may be different than the actual link text.
- url_title: The anchor text for the link.
- url: A \Drupal\Core\Url object.
File
-
core/
modules/ link/ link.module, line 66
Code
function template_preprocess_link_formatter_link_separate(&$variables) {
$variables['link'] = Link::fromTextAndUrl($variables['url_title'], $variables['url'])->toString();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.