function theme_imagefield_extended_formatter_ife in ImageField Extended 6.4
Same name and namespace in other branches
- 6.3 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 323 - Insert additional fields into a FileField / 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' => t('!ife:' . $key, array(
'!ife:' . $key => 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' => t('!ife:workflow_' . $key, array(
'!ife:workflow_' . $key => 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);
}