You are here

function field_timer_field_formatter_info in Field Timer 7.2

Same name and namespace in other branches
  1. 7 field_timer.module \field_timer_field_formatter_info()

Implements hook_field_formatter_info().

File

./field_timer.module, line 128
Main module file.

Code

function field_timer_field_formatter_info() {
  $field_types = array(
    'field_timer',
    'datestamp',
    'date',
    'datetime',
  );
  $formatter_types = array(
    'field_timer_text',
    'field_timer_county',
    'field_timer_jquery_countdown',
    'field_timer_jquery_countdown_led',
  );
  $formatters = array();
  foreach ($formatter_types as $formatter) {
    foreach ($field_types as $field) {
      $class = $formatter . '_' . $field;
      $handler = new $class();
      if ($handler
        ->enableFormatter()) {
        if (!isset($formatters[$formatter])) {
          $formatters[$formatter] = $handler
            ->getFormatterDefinition();
          $formatters[$formatter]['field types'] = array();
          $formatters[$formatter]['settings'] = array();
        }
        $formatters[$formatter]['field types'][] = $field;
        $formatters[$formatter]['settings'] += $handler
          ->getDefaultSettings();
      }
    }
  }
  return $formatters;
}