On the Display Fields page I select Label: Hidden. But the label is not hidden.
Thanks for a useful module! / Henrik

Comments

alan d.’s picture

Which part are you referring to? The label on the CCK field, or the internal labels on the ImageField Extended additional fields?

Also, just in case it matters, what versions are you using? I just searched FileField and ImageField for this reference string (FileField drives ImageField which in turn drives IF Extended), and I could not locate a single reference to the string "Hidden"

hs@henrikstrindberg.se’s picture

When defining an ImageField Extended additional field, that field gets a label. This label is hidden on the teaser but printed on the full node. I want it hidden always. Maybe I have missed something but I don't see how to do that.

So if I've got it right this time this is a feature request: to have the possibility to show or hide the labels of the ImageField Extended additional fields.

Thanks / Henrik

(And, yes, I see what you mean: to select label->hidden on the page admin/content/node-type/mytype/display hides the label of the CCK field. I use FileField 6x-3.2, ImageField 6x-3.2).

alan d.’s picture

Component: Code » Documentation
Category: task » support

Gotcha

Two easiest methods are:

1) Via CSS

The FIELDNAME is the CCK fieldname without the "field_" prefix.

For all content types:

.field-field-FIELDNAME .imagefield-field_FIELDNAME-wrapper label {
  display: none;
}

For a specific content type:

.node-type-TYPE .field-field-FIELDNAME .imagefield-field_FIELDNAME-wrapper label {
  display: none;
}

2) Re-render the additional fields just before rendering them.

The easiest way is via the imagefield-extended-image.tpl.php template. Copy and paste this file into your theme directory, and add the following to the top of the file. You must flush your cache before this new file is registered with the Drupal theme registry.

<?php
  $fields = array();
  foreach ($fapi_fields as $field) {
    $field['#title'] = NULL;
    $fields[] = drupal_render($field);
  }
?>

3) Best, but a bit more complex, override the main formatter theming function. Cut and psate into your themes template.php file.

This one does not render checkboxes (as hidden values) or text elements with titles.

<?php
/**
 * ImageField Extended formatter theme callback.
 * Does not render checkboxes or text with titles.
 */
function phptemplate_imagefield_extended_formatter_ife($element) {
  // Inside a view $element may contain null data. In that case, just return.
  if (empty($element['#item']['fid'])) {
    return '';
  }
  $item = $element['#item'];
  if (!is_file($item['filepath'])) {
    return '<!-- File not found: '. $item['filepath'] .' -->';
  }

  $item['data']['alt'] = isset($item['data']['alt']) ? $item['data']['alt'] : '';
  $item['data']['title'] = isset($item['data']['title']) ? $item['data']['title'] : NULL;

  $field = content_fields($element['#field_name'], $element['#node']->type);
  $widget = $field['widget'];
  $data = array();
  $extended_fields = _imagefield_extended_fields();
  foreach ($extended_fields['textfields'] as $key => $title) {
    if (!empty($widget['custom_'. $key])) {
      $text = imagefield_extended_check_text($item['data'][$key]);
      if (!empty($text)) {
        $data[$key] = array(
          '#type' => 'item',
          '#value' => $text,
        );
      }
    }
  }
  $item['field_name'] = $element['#field_name'];
  $item['formatter'] = $element['#formatter'];

  return theme('imagefield_extended_image', $item, $data);
}

?>
hs@henrikstrindberg.se’s picture

Thanks!

/ Henrik

alan d.’s picture

Status: Active » Closed (fixed)

I've added a note in the docs to reference this page. Let me know if you had any issues with the above examples.