function _emthumb_formatter_theme_helper in Embedded Media Field 6
Same name and namespace in other branches
- 6.3 contrib/emthumb/emthumb.theme.inc \_emthumb_formatter_theme_helper()
- 6.2 contrib/emthumb/emthumb.theme.inc \_emthumb_formatter_theme_helper()
Sets up the options array with the proper node, field, etc.
11 calls to _emthumb_formatter_theme_helper()
- theme_emthumb_imagecache_formatter_full in contrib/
emthumb/ emthumb.theme.inc - Returns the imagecache image linked to a full media display.
- theme_emthumb_imagecache_formatter_imagelink in contrib/
emthumb/ emthumb.theme.inc - Returns the imagecache image linked to the original image.
- theme_emthumb_imagecache_formatter_lightbox2 in contrib/
emthumb/ emthumb.theme.inc - Returns the imagecache image linked to a modal lightbox2.
- theme_emthumb_imagecache_formatter_linked in contrib/
emthumb/ emthumb.theme.inc - Returns the imagecache image linked to the node.
- theme_emthumb_imagecache_formatter_path in contrib/
emthumb/ emthumb.theme.inc - Returns the path to the imagecache image.
File
- contrib/
emthumb/ emthumb.theme.inc, line 166 - Theme functions for the Embedded Media Thumbnail module.
Code
function _emthumb_formatter_theme_helper($element) {
$options['field'] = content_fields($element['#field_name'], $element['#type_name']);
$options['module'] = $options['field']['module'];
$options['formatter'] = $element['#formatter'];
$options['node'] = $element['#node'];
$options['element'] = $element;
$options['delta'] = $element['#delta'];
$options['presetname'] = substr($element['#formatter'], 0, strrpos($element['#formatter'], '_'));
// If we're coming from a preview, we need to extract our new embedded value.
if (isset($element['#node']->in_preview)) {
$element['#item'] = emfield_parse_embed($options['field'], $element['#item'], $options['module']);
}
// If we have no value, then return an empty string.
if (!isset($element['#item'])) {
return '';
}
$options['item'] = $element['#item'];
// Unfortunately, when we come from a view, we don't get all the widget fields.
if (!$options['node']->type) {
$type = content_types($element['#type_name']);
$options['field']['widget'] = $type['fields'][$field['field_name']]['widget'];
}
// Sometimes our data is still unserialized, again from views.
if (!is_array($options['item']['data'])) {
$options['item']['data'] = (array) unserialize($options['item']['data']);
}
return $options;
}