function theme_link_field in Link 7
Formats a link field widget.
1 theme call to theme_link_field()
- link_element_info in ./
link.module - Implements hook_element_info().
File
- ./
link.module, line 1015 - Defines simple link field types.
Code
function theme_link_field($vars) {
drupal_add_css(drupal_get_path('module', 'link') . '/css/link.css');
$element = $vars['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 clearfix">';
if (isset($element['title'])) {
$output .= '<div class="link-field-title link-field-column">' . drupal_render($element['title']) . '</div>';
}
$output .= '<div class="link-field-url' . (isset($element['title']) ? ' link-field-column' : '') . '">' . drupal_render($element['url']) . '</div>';
$output .= '</div>';
if (!empty($element['attributes']['target'])) {
$output .= '<div class="link-attributes">' . drupal_render($element['attributes']['target']) . '</div>';
}
if (!empty($element['attributes']['title'])) {
$output .= '<div class="link-attributes">' . drupal_render($element['attributes']['title']) . '</div>';
}
if (!empty($element['attributes']['class'])) {
$output .= '<div class="link-attributes">' . drupal_render($element['attributes']['class']) . '</div>';
}
$output .= drupal_render_children($element);
return $output;
}