' . t('About') . '';
$output .= '
' . t('The Link module allows you to create fields that contain internal or external URLs and optional link text. See the Field module help and the Field UI help pages for general information on fields and how to create and manage them. For more information, see the online documentation for the Link module.', [':field' => \Drupal::url('help.page', ['name' => 'field']), ':field_ui' => (\Drupal::moduleHandler()->moduleExists('field_ui')) ? \Drupal::url('help.page', ['name' => 'field_ui']) : '#', ':link_documentation' => 'https://www.drupal.org/documentation/modules/link']) . '
';
$output .= '' . t('Uses') . '
';
$output .= '';
$output .= '- ' . t('Managing and displaying link fields') . '
';
$output .= '- ' . t('The settings and the display of the link field can be configured separately. See the Field UI help for more information on how to manage fields and their display.', [':field_ui' => (\Drupal::moduleHandler()->moduleExists('field_ui')) ? \Drupal::url('help.page', ['name' => 'field_ui']) : '#']) . '
';
$output .= '- ' . t('Setting the allowed link type') . '
';
$output .= '- ' . t('In the field settings you can define the allowed link type to be internal links only, external links only, or both internal and external links. Internal links only and both internal and external links options enable an autocomplete widget for internal links, so a user does not have to copy or remember a URL.') . '
';
$output .= '- ' . t('Adding link text') . '
';
$output .= '- ' . t('In the field settings you can define additional link text to be optional or required in any link field.') . '
';
$output .= '- ' . t('Displaying link text') . '
';
$output .= '- ' . t('If link text has been submitted for a URL, then by default this link text is displayed as a link to the URL. If you want to display both the link text and the URL, choose the appropriate link format from the drop-down menu in the Manage display page. If you only want to display the URL even if link text has been submitted, choose Link as the format, and then change its Format settings to display URL only.') . '
';
$output .= '- ' . t('Adding attributes to links') . '
';
$output .= '- ' . t('You can add attributes to links, by changing the Format settings in the Manage display page. Adding rel="nofollow" notifies search engines that links should not be followed.') . '
';
$output .= '- ' . t('Validating URLs') . '
';
$output .= '- ' . t('All links are validated after a link field is filled in. They can include anchors or query strings.') . '
';
$output .= '
';
return $output;
}
}
/**
* Implements hook_theme().
*/
function link_theme() {
return [
'link_formatter_link_separate' => [
'variables' => ['title' => NULL, 'url_title' => NULL, 'url' => NULL],
],
];
}
/**
* Prepares variables for separated link field templates.
*
* This template outputs a separate title and link.
*
* Default template: link-formatter-link-separate.html.twig.
*
* @param 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.
*/
function template_preprocess_link_formatter_link_separate(&$variables) {
$variables['link'] = \Drupal::l($variables['url_title'], $variables['url']);
}