You are here

function theme_link_formatter_link_default in Link 7

Formats a link.

File

./link.module, line 1327
Defines simple link field types.

Code

function theme_link_formatter_link_default($vars) {
  $link_options = $vars['element'];
  unset($link_options['title']);
  unset($link_options['url']);
  if (isset($link_options['attributes']['class'])) {
    $link_options['attributes']['class'] = array(
      $link_options['attributes']['class'],
    );
  }

  // Display a normal link if both title and URL are available.
  if (!empty($vars['element']['title']) && !empty($vars['element']['url'])) {
    return l($vars['element']['title'], rawurldecode($vars['element']['url']), $link_options);
  }
  elseif (!empty($vars['element']['title'])) {
    return !empty($link_options['html']) ? $vars['element']['title'] : check_plain($vars['element']['title']);
  }
  elseif (!empty($vars['element']['url'])) {
    return l($vars['element']['title'], rawurldecode($vars['element']['url']), $link_options);
  }
}