Commit e2426818 authored by Nathan Haug's avatar Nathan Haug
Browse files

Cleanup of link field labels when not displaying the title field.

parent 996d0f9e
......@@ -439,17 +439,22 @@ 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 (!$element['#field']['multiple'] && isset($element['url']) && isset($element['title'])) {
$element['url']['#title'] = $element['#title'] .' '. $element['url']['#title'];
$element['title']['#title'] = $element['#title'] .' '. $element['title']['#title'];
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 ($element['title']) {
if (isset($element['title'])) {
$output .= '<div class="link-field-title link-field-column">' . theme('textfield', $element['title']) . '</div>';
}
$output .= '<div class="link-field-url' . ($element['title'] ? ' link-field-column' : '') . '">' . theme('textfield', $element['url']) . '</div>';
$output .= '<div class="link-field-url' . (isset($element['title']) ? ' link-field-column' : '') . '">' . theme('textfield', $element['url']) . '</div>';
$output .= '</div>';
if (!empty($element['attributes'])) {
$output .= '<div class="link-attributes">' . theme('form_element', $element['attributes'], $element['attributes']['#value']) . '</div>';
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment