function photoswipe_field_formatter_info in PhotoSwipe 6
Same name and namespace in other branches
- 7.2 photoswipe.module \photoswipe_field_formatter_info()
- 7 photoswipe.module \photoswipe_field_formatter_info()
Implementation of hook_field_formatter_info().
Add certain photoswipe+imagecache formatters to CCK image fields if the imagefield.module and the imagecache.module exist.
File
- ./
photoswipe.module, line 195
Code
function photoswipe_field_formatter_info() {
$formatters = array();
if (module_exists('imagecache') && module_exists('imagefield')) {
$presets = photoswipe_get_imagecache_presets(TRUE);
$types = array(
'filefield',
);
foreach ($presets as $preset) {
$formatters["photoswipe___original___{$preset}"] = array(
'label' => "PhotoSwipe [all]: original to {$preset}",
'field types' => $types,
);
$formatters["photoswipe___{$preset}___original"] = array(
'label' => "PhotoSwipe [all]: {$preset} to original",
'field types' => $types,
);
$formatters["photoswipe_field___original___{$preset}"] = array(
'label' => "PhotoSwipe [field]: original to {$preset}",
'field types' => $types,
);
$formatters["photoswipe_field___{$preset}___original"] = array(
'label' => "PhotoSwipe [field]: {$preset} to original",
'field types' => $types,
);
$formatters["photoswipe_nid___original___{$preset}"] = array(
'label' => "PhotoSwipe [nid]: original to {$preset}",
'field types' => $types,
);
$formatters["photoswipe_nid___{$preset}___original"] = array(
'label' => "PhotoSwipe [nid]: {$preset} to original",
'field types' => $types,
);
foreach ($presets as $preset_alt) {
if ($preset != $preset_alt) {
$formatters["photoswipe___{$preset}___{$preset_alt}"] = array(
'label' => "PhotoSwipe [all]: {$preset} to {$preset_alt}",
'field types' => $types,
);
$formatters["photoswipe_field___{$preset}___{$preset_alt}"] = array(
'label' => "PhotoSwipe [field]: {$preset} to {$preset_alt}",
'field types' => $types,
);
$formatters["photoswipe_nid___{$preset}___{$preset_alt}"] = array(
'label' => "PhotoSwipe [nid]: {$preset} to {$preset_alt}",
'field types' => $types,
);
}
}
}
}
if (is_array($formatters)) {
asort($formatters);
}
return $formatters;
}