You are here

function availability_calendar_field_formatter_settings_summary in Availability Calendars 7.4

Same name and namespace in other branches
  1. 7.5 availability_calendar.field.inc \availability_calendar_field_formatter_settings_summary()
  2. 7.3 availability_calendar.field.inc \availability_calendar_field_formatter_settings_summary()

Implements hook_field_formatter_settings_summary(). @link http://api.drupal.org/api/drupal/modules--field_ui--field_ui.api.php/fun...

File

./availability_calendar.field.inc, line 522

Code

function availability_calendar_field_formatter_settings_summary($field, $instance, $view_mode) {
  $display = $instance['display'][$view_mode];
  $settings = $display['settings'];
  $summary = array();
  $summary[] = t('Show');
  $summary[] = format_plural($settings['show_number_of_months'], '1 month', '@count months');
  if ($display['type'] === 'availability_calendar_colorbox') {
    $summary[] = t('in a Colorbox');
  }
  else {
    if ($display['type'] === 'availability_calendar_viewport') {
      if (substr($settings['viewport']['dimensions_calculation'], 0, strlen('responsive')) === 'responsive') {
        $summary[] = t('in a responsive viewport of');
        $summary[] = format_plural($settings['viewport']['rows'], '1 row', '@count rows');
      }
      else {
        $summary[] = t('in a viewport of @count by', array(
          '@count' => $settings['viewport']['cols'],
        ));
        $summary[] = format_plural($settings['viewport']['rows'], '1 month', '@count months');
      }
    }
  }
  return implode(' ', $summary);
}