You are here

function theme_imagefield_extended_formatter_ife in ImageField Extended 6.3

Same name and namespace in other branches
  1. 6.4 imagefield_extended.module \theme_imagefield_extended_formatter_ife()

ImageField Extended formatter theme callback.

1 string reference to 'theme_imagefield_extended_formatter_ife'
imagefield_extended_theme in ./imagefield_extended.module
Implementation of hook_theme().

File

./imagefield_extended.module, line 343
Insert additional fields into an ImageField data array.

Code

function theme_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(
          '#title' => check_plain($title),
          '#type' => 'item',
          '#value' => $text,
        );
      }
    }
  }
  foreach ($extended_fields['checkboxes'] as $key => $title) {
    if (!empty($widget['workflow_' . $key])) {
      $data[$key] = array(
        '#type' => 'value',
        '#title' => check_plain($title),
        '#value' => !empty($widget['workflow_' . $key]),
      );
    }
  }
  $item['field_name'] = $element['#field_name'];
  $item['formatter'] = $element['#formatter'];
  return theme('imagefield_extended_image', $item, $data);
}