You are here

function theme_link in Link 6.2

Same name and namespace in other branches
  1. 6 link.module \theme_link()

FAPI theme for an individual text elements.

File

./link.theme.inc, line 25
Theme functions for the link module.

Code

function theme_link($element) {
  drupal_add_css(drupal_get_path('module', 'link') . '/link.css');

  // Prefix single value link fields with the name of the field.
  if (empty($element['#field']['multiple'])) {
    if (isset($element['url']) && isset($element['title'])) {
      $element['url']['#title'] = $element['#title'] . ' ' . $element['url']['#title'];
      $element['title']['#title'] = $element['#title'] . ' ' . $element['title']['#title'];
    }
    elseif ($element['url']) {
      $element['url']['#title'] = $element['#title'];
    }
  }
  $output = '';
  $output .= '<div class="link-field-subrow clear-block">';
  if (isset($element['title'])) {
    $output .= '<div class="link-field-title link-field-column">' . theme('textfield', $element['title']) . '</div>';
  }
  $output .= '<div class="link-field-url' . (isset($element['title']) ? ' link-field-column' : '') . '">' . theme('textfield', $element['url']) . '</div>';
  $output .= '</div>';
  if (!empty($element['attributes']['target'])) {
    $output .= '<div class="link-attributes">' . theme('checkbox', $element['attributes']['target']) . '</div>';
  }
  return $output;
}