function lightbox2_field_formatter_info in Lightbox2 5.2
Same name and namespace in other branches
- 8 lightbox2.module \lightbox2_field_formatter_info()
- 5 lightbox2.module \lightbox2_field_formatter_info()
- 6 lightbox2.module \lightbox2_field_formatter_info()
- 7.2 lightbox2.module \lightbox2_field_formatter_info()
- 7 lightbox2.module \lightbox2_field_formatter_info()
Implementation of hook_field_formatter_info().
Add certain lightbox+imagecache formatters to CCK image fields if the imagefield.module and the imagecache.module exist. Add additional formatters if emfield, image_ncck and/or video_cck modules exist.
File
- ./
lightbox2.module, line 1686 - 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_info() {
$formatters = array();
$lightbox = $slideshow = $iframe = array();
if (module_exists('imagefield') && module_exists('imagecache')) {
$rules = array();
if (function_exists('imagecache_presets')) {
$presets = imagecache_presets();
foreach ($presets as $preset_id => $preset_info) {
$rules[$preset_id] = $preset_info['presetname'];
}
}
else {
$rules = _imagecache_get_presets();
}
$iframe['lightframe2][original][node'] = array(
'label' => 'Lightbox2 iframe: original->node page',
'field types' => array(
'image',
),
);
foreach ($rules as $ruleid => $view_rule) {
$lightbox['lightbox2][original][' . $view_rule] = array(
'label' => 'Lightbox2: original->' . $view_rule,
'field types' => array(
'image',
),
);
$lightbox['lightbox2][' . $view_rule . '][original'] = array(
'label' => 'Lightbox2: ' . $view_rule . '->original',
'field types' => array(
'image',
),
);
$slideshow['lightshow2][original][' . $view_rule] = array(
'label' => 'Lightbox2 slideshow: original->' . $view_rule,
'field types' => array(
'image',
),
);
$slideshow['lightshow2][' . $view_rule . '][original'] = array(
'label' => 'Lightbox2 slideshow: ' . $view_rule . '->original',
'field types' => array(
'image',
),
);
foreach ($rules as $rid => $lightbox_rule) {
$lightbox['lightbox2][' . $view_rule . '][' . $lightbox_rule] = array(
'label' => 'Lightbox2: ' . $view_rule . '->' . $lightbox_rule,
'field types' => array(
'image',
),
);
$slideshow['lightshow2][' . $view_rule . '][' . $lightbox_rule] = array(
'label' => 'Lightbox2 slideshow: ' . $view_rule . '->' . $lightbox_rule,
'field types' => array(
'image',
),
);
$iframe['lightframe2][' . $view_rule . '][node'] = array(
'label' => 'Lightbox2 iframe: ' . $view_rule . '->node page',
'field types' => array(
'image',
),
);
}
}
// Adding them now so they are in some sort of sensible order.
$formatters = array_merge($lightbox, $slideshow, $iframe);
}
if (module_exists('emfield') && module_exists('image_ncck')) {
$formatters['lightbox2][image_ncck'] = array(
'label' => t('Lightbox2: Image Thumbnail -> Original'),
'field types' => array(
'image_ncck',
),
);
$formatters['lightshow2][image_ncck'] = array(
'label' => t('Lightbox2 slideshow: Image Thumbnail -> Original'),
'field types' => array(
'image_ncck',
),
);
$formatters['lightframe2][image_ncck'] = array(
'label' => t('Lightbox2 iframe: Image Thumbnail -> Content'),
'field types' => array(
'image_ncck',
),
);
}
if (variable_get('lightbox2_enable_video', FALSE) && module_exists('emfield') && module_exists('video_cck')) {
$formatters['lightvideo'] = array(
'label' => t('Lightbox2: Image Thumbnail -> Full Size Video'),
'field types' => array(
'video_cck',
),
);
}
if (module_exists('filefield')) {
$formatters['lightframe2][filefield'] = array(
'label' => t('Lightbox2 iframe'),
'field types' => array(
'file',
),
);
}
return $formatters;
}