function theme_link in Link 6
Same name and namespace in other branches
- 6.2 link.theme.inc \theme_link()
FAPI theme for an individual text elements.
File
- ./
link.module, line 415 - Defines simple link field types.
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;
}