You are here

function track_da_files_field_formatter_info in Track da files 7

Implements hook_field_formatter_info().

Add Track da files formatters to file/image fields.

File

./track_da_files.module, line 165
This file contains Track da files main functions.

Code

function track_da_files_field_formatter_info() {
  $formatters = array();
  $track_da_files_colorbox_enabled = variable_get('track_da_files_colorbox_enabled', 0);

  // Handle file field files.
  $formatters['track_da_files_file_default'] = array(
    'label' => t('tdf: Generic file'),
    'field types' => array(
      'file',
    ),
    'settings' => array(
      'force_download' => '',
      'custom_link_text' => '',
    ),
  );
  $formatters['track_da_files_url_plain'] = array(
    'label' => t('tdf: URL to file'),
    'field types' => array(
      'file',
    ),
  );
  $formatters['track_da_files_file_table'] = array(
    'label' => t('tdf: Table of files'),
    'field types' => array(
      'file',
    ),
    'settings' => array(
      'force_download' => '',
      'custom_link_text' => '',
    ),
  );

  // Handle image field files.
  $formatters['track_da_files_image'] = array(
    'label' => t('tdf: Image'),
    'field types' => array(
      'image',
    ),
    'settings' => array(
      'image_style' => '',
      'force_download' => '',
    ),
  );

  // Handle image colorbox field files.
  if ($track_da_files_colorbox_enabled == 1) {
    $formatters['track_da_files_colorbox_image'] = array(
      'label' => t('tdf: Colorbox image'),
      'field types' => array(
        'image',
      ),
      'settings' => array(
        'image_style' => '',
      ),
    );
  }
  return $formatters;
}