You are here

function shadowbox_field_formatter_info in Shadowbox 6.3

Same name and namespace in other branches
  1. 5.2 shadowbox.module \shadowbox_field_formatter_info()
  2. 5 shadowbox.module \shadowbox_field_formatter_info()
  3. 6.4 shadowbox.module \shadowbox_field_formatter_info()
  4. 6.2 shadowbox.module \shadowbox_field_formatter_info()
  5. 7.3 shadowbox.module \shadowbox_field_formatter_info()

Implementation of hook_field_formatter_info().

Add certain shadowbox+imagecache formatters to CCK image fields if the imagefield.module and the imagecache.module exist.

File

./shadowbox.module, line 94
Shadowbox, a JavaScript media viewer application for displaying content in a modal dialogue.

Code

function shadowbox_field_formatter_info() {
  $formatters = array();
  if (module_exists('imagecache') && module_exists('imagefield')) {
    $presets = shadowbox_get_imagecache_presets(TRUE);
    $types = array(
      'filefield',
    );
    foreach ($presets as $preset) {
      $formatters["shadowbox___original___{$preset}"] = array(
        'label' => "SB: original to {$preset}",
        'field types' => $types,
      );
      $formatters["shadowbox___{$preset}___original"] = array(
        'label' => "SB: {$preset} to original",
        'field types' => $types,
      );
      $formatters["shadowbox_gallery___original___{$preset}"] = array(
        'label' => "SB G page: original to {$preset}",
        'field types' => $types,
      );
      $formatters["shadowbox_gallery___{$preset}___original"] = array(
        'label' => "SB G page: {$preset} to original",
        'field types' => $types,
      );
      $formatters["shadowbox_gallery_field___original___{$preset}"] = array(
        'label' => "SB G field: original to {$preset}",
        'field types' => $types,
      );
      $formatters["shadowbox_gallery_field___{$preset}___original"] = array(
        'label' => "SB G field: {$preset} to original",
        'field types' => $types,
      );
      $formatters["shadowbox_gallery_nid___original___{$preset}"] = array(
        'label' => "SB G nid: original to {$preset}",
        'field types' => $types,
      );
      $formatters["shadowbox_gallery_nid___{$preset}___original"] = array(
        'label' => "SB G nid: {$preset} to original",
        'field types' => $types,
      );
      foreach ($presets as $preset_alt) {
        if ($preset != $preset_alt) {
          $formatters["shadowbox___{$preset}___{$preset_alt}"] = array(
            'label' => "SB: {$preset} to {$preset_alt}",
            'field types' => $types,
          );
          $formatters["shadowbox_gallery___{$preset}___{$preset_alt}"] = array(
            'label' => "SB G page: {$preset} to {$preset_alt}",
            'field types' => $types,
          );
          $formatters["shadowbox_gallery_field___{$preset}___{$preset_alt}"] = array(
            'label' => "SB G field: {$preset} to {$preset_alt}",
            'field types' => $types,
          );
          $formatters["shadowbox_gallery_nid___{$preset}___{$preset_alt}"] = array(
            'label' => "SB G nid: {$preset} to {$preset_alt}",
            'field types' => $types,
          );
        }
      }
    }
  }
  if (is_array($formatters)) {
    asort($formatters);
  }
  return $formatters;
}