1 link.theme.inc theme_link_formatter_link_domain($variables)

Formats a link using the URL's domain for it's link text.

File

core/modules/link/link.theme.inc, line 91
Theme functions and preprocessing for Link module output.

Code

function theme_link_formatter_link_domain($variables) {
  $link_options = $variables['element'];
  unset($link_options['title']);
  unset($link_options['url']);
  $domain = parse_url($variables['element']['display_url'], PHP_URL_HOST);
  if (!empty($variables['display']['settings']['strip_www'])) {
    $domain = str_replace('www.', '', $domain);
  }
  return $variables['element']['url'] ? l($domain, $variables['element']['url'], $link_options) : '';
}