Help text
BWPanda - August 18, 2009 - 00:01
| Project: | Link |
| Version: | 6.x-2.6 |
| Component: | User interface |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
Currently, the help text is only displayed below the URL textfield. This tends to look weird when the URL and Title textfields are side-by-side...
I recommend either having two separate help texts (one for each textfield), or placing the help text below both textfields so it spans them both.
I couldn't work out how to do this myself, so no patch sorry.

#1
This seems to be bound into the nature of a cck field. I'm going to look into it further later, but it's not a simple fix off of the top of my head.
#2
I got around this by overriding the theme_link() function in my theme.
I simply manually set the description and unset it from the URL form element array.
The only short coming that I can see is that if somebody had to override theme_form_element() and changed the description style this would have no affect on link field descriptions and there is now some extra space between the form fields and the description.
<?php
/**
* FAPI theme for an individual text elements.
*/
function theme_name_link($element) {
drupal_add_css(drupal_get_path('module', 'link') .'/link.css');
$description = '';
if (!empty($element['url']['#description'])) {
$description = '<div class="description">'. $element['url']['#description'] ."</div>\n";
unset($element['url']['#description']);
}
// 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>';
}
$output .= $description;
return $output;
}
?>