function lightbox2_field_formatter in Lightbox2 5.2
Same name and namespace in other branches
- 5 lightbox2.module \lightbox2_field_formatter()
Implementation of hook_field_formatter().
File
- ./
lightbox2.module, line 1772 - Enables the use of lightbox2 which places images above your current page, not within. This frees you from the constraints of the layout, particularly column widths.
Code
function lightbox2_field_formatter($field, $item, $formatter, $node) {
// Emfield video fields.
if ($formatter == 'lightvideo' && variable_get('lightbox2_enable_video', FALSE)) {
if (module_exists('emfield') && module_exists('video_cck')) {
$formatter = 'video_cck';
return module_invoke('emfield', 'emfield_field_formatter', $field, $item, $formatter, $node, 'lightbox2');
}
}
elseif (strpos($formatter, 'lightbox2][') !== FALSE || strpos($formatter, 'lightshow2][') !== FALSE || strpos($formatter, 'lightframe2][') !== FALSE) {
list($lightbox_type, $view_preset, $lightbox_preset) = explode('][', $formatter, 3);
// Emfield image field.
if ($view_preset == 'image_ncck' && module_exists('emfield') && module_exists('image_ncck')) {
$formatter = $view_preset;
$field['lightbox_type'] = $lightbox_type;
return module_invoke('emfield', 'emfield_field_formatter', $field, $item, $formatter, $node, 'lightbox2');
}
elseif ($view_preset == 'filefield' && module_exists('filefield')) {
return lightbox2_filefield_formatter($field, $item, $formatter, $node);
}
elseif (module_exists('imagefield') && module_exists('imagecache')) {
return lightbox2_imagefield_image_imagecache($field, $item, $formatter, $node, $view_preset, $lightbox_preset);
}
}
}