You are here

function pdfpreview_field_formatter_info in PDFPreview 6

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

Implements hook_field_formatter_info().

File

./pdfpreview.module, line 25
This module creates a formatter for CCK filefields that shows a snapshot of the first page of pdf files as link to the file.

Code

function pdfpreview_field_formatter_info() {
  $formatters = array(
    'default' => array(
      'label' => t('PDF Preview'),
      'field types' => array(
        'filefield',
      ),
      '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;
}