You are here

function theme_link_formatter_link_separate in Link 7

Formats a link as separate title and URL elements.

File

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

Code

function theme_link_formatter_link_separate($vars) {
  $class = empty($vars['element']['attributes']['class']) ? '' : ' ' . $vars['element']['attributes']['class'];
  unset($vars['element']['attributes']['class']);
  $link_options = $vars['element'];
  unset($link_options['title']);
  unset($link_options['url']);
  $title = empty($vars['element']['title']) ? '' : check_plain($vars['element']['title']);

  // @todo Static html markup looks not very elegant, needs smarter output
  // solution and an optional title/URL seperator.
  $url_parts = _link_parse_url($vars['element']['url']);
  $output = '';
  $output .= '<div class="link-item ' . $class . '">';
  if (!empty($title)) {
    $output .= '<div class="link-title">' . $title . '</div>';
  }
  $output .= '<div class="link-url">' . l($url_parts['url'], $vars['element']['url'], $link_options) . '</div>';
  $output .= '</div>';
  return $output;
}