1.20.x link.theme.inc theme_link_field($variables)

Formats a link field widget.

File

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

Code

function theme_link_field($variables) {
  $element = $variables['element'];
  // 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_display'] = 'invisible';
    }
  }

  $output = '';
  $output .= '<div class="link-field-subrow">';
  if (isset($element['title'])) {
    $output .= '<div class="link-field-title link-field-column">' . backdrop_render($element['title']) . '</div>';
  }
  $output .= '<div class="link-field-url' . (isset($element['title']) ? ' link-field-column' : '') . '">' . backdrop_render($element['url']) . '</div>';
  $output .= '</div>';
  if (!empty($element['attributes']['target'])) {
    $output .= '<div class="link-attributes">' . backdrop_render($element['attributes']['target']) . '</div>';
  }
  if (!empty($element['attributes']['title'])) {
    $output .= '<div class="link-attributes">' . backdrop_render($element['attributes']['title']) . '</div>';
  }
  if (!empty($element['attributes']['class'])) {
    $output .= '<div class="link-attributes">' . backdrop_render($element['attributes']['class']) . '</div>';
  }
  $output .= backdrop_render_children($element);
  return $output;
}