You are here

function hover_preview_field_formatter_info in Hover Preview for ImageCache 6

Same name and namespace in other branches
  1. 7 hover_preview.module \hover_preview_field_formatter_info()

Implementation of hook_field_formatter_info(). Adds formatters to CCK image fields

File

./hover_preview.module, line 43
Hover Preview for Imagecache.

Code

function hover_preview_field_formatter_info() {
  $presets_a = imagecache_presets();
  $presets_b = $presets_a;
  $formatters = array();
  foreach ($presets_a as $preset_a) {
    foreach ($presets_b as $preset_b) {

      // Hover only
      $id = $preset_a['presetname'] . '_hover_preview_' . $preset_b['presetname'];
      $formatters[$id] = array(
        'label' => t('Hover: @preset_a TO: @preset_b', array(
          '@preset_a' => $preset_a['presetname'],
          '@preset_b' => $preset_b['presetname'],
        )),
        'field types' => array(
          'image',
          'filefield',
        ),
      );

      // Hover, linked to original node
      $id = $preset_a['presetname'] . '_hover_preview_' . $preset_b['presetname'] . '_linked';
      $formatters[$id] = array(
        'label' => t('Hover: @preset_a TO: @preset_b linked to node', array(
          '@preset_a' => $preset_a['presetname'],
          '@preset_b' => $preset_b['presetname'],
        )),
        'field types' => array(
          'image',
          'filefield',
        ),
      );
    }
  }
  return $formatters;
}