You are here

function timefield_field_formatter_settings_summary in Timefield 7

Implements hook_field_formatter_settings_summary().

File

./timefield.module, line 518
Defines a Field API field for time

Code

function timefield_field_formatter_settings_summary($field, $instance, $view_mode) {
  $display = $instance['display'][$view_mode];
  $settings = $display['settings'];
  $field_settings = $field['settings'];
  if ($display['type'] == 'timefield_default') {
    $current_time = timefield_time_to_integer(date('g:ia', strtotime("now")));
    return t('Current Format') . ': ' . timefield_integer_to_time($settings['display_format'], $current_time);
  }
  elseif ($display['type'] == 'timefield_duration') {
    if (empty($field_settings['totime'])) {
      return t('This display format is invalid for the current field configuration');
    }
    else {
      return t('Current Format') . ': ' . _timefield_duration_options($settings['duration_format']);
    }
  }
  elseif ($display['type'] == 'timefield_weekly_summary_minical') {
    if (!$field_settings['weekly_summary'] || !$field_settings['weekly_summary_with_label']) {
      return t('This display format is invalid for the current field configuration');
    }
    else {
      return t('Current Format: Mini Calendar Format, expand to see current Selection');
    }
  }
}