Contributions API

lightbox2_field_formatter

Definition

lightbox2_field_formatter($field, $item, $formatter, $node)
contributions/lightbox2/lightbox2.module, line 806

Description

Implementation of hook_field_formatter().

Code

<?php
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');
    }
  }

  // Image fields - emfield or imagecache + imagefield.
  else if (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');
    }

    // Filefield.
    else if ($view_preset == 'filefield' && module_exists('filefield')) {
      return lightbox2_filefield_formatter($field, $item, $formatter, $node);
    }

    // Imagecache + imagefield image.
    else if (module_exists('imagefield') && module_exists('imagecache')) {
      return lightbox2_imagefield_image_imagecache($field, $item, $formatter, $node, $view_preset, $lightbox_preset);
    }
  }
}
?>