You are here

function pdfpreview_field_formatter_info in PDFPreview 7

Same name and namespace in other branches
  1. 6 pdfpreview.module \pdfpreview_field_formatter_info()
  2. 7.2 pdfpreview.module \pdfpreview_field_formatter_info()

Implements hook_field_formatter_info()

@todo What's the imagecache thing doing?

File

./pdfpreview.module, line 17
This file contains hooks for the pdfpreview module

Code

function pdfpreview_field_formatter_info() {
  $formatters = array(
    'default' => array(
      'label' => t('PDF Preview'),
      'field types' => array(
        'file',
      ),
      'description' => t('Displays an snapshot of the first page of the PDF'),
    ),
  );
  if (module_exists('imagecache')) {
    foreach (imagecache_presets() as $preset) {
      $formatters[$preset['presetname'] . '][pdfpreview'] = array(
        'label' => t('PDF Preview: @preset image', array(
          '@preset' => $preset['presetname'],
        )),
        'field types' => array(
          'filefield',
        ),
        'description' => t('Display an snapshot using imagecache preset @preset', array(
          '@preset' => $preset['presetname'],
        )),
      );
    }
  }
  return $formatters;
}