You are here

protected function field_timer_text_base::granularitySettingsSummary in Field Timer 7.2

2 calls to field_timer_text_base::granularitySettingsSummary()
field_timer_text_base::getSettingsSummary in includes/field_timer_text.inc
@inheritdoc
field_timer_text_date_field_base::getSettingsSummary in includes/field_timer_text.inc
@inheritdoc

File

includes/field_timer_text.inc, line 189
Contains help classes to perform field_timer_text formatter related actions.

Class

field_timer_text_base
Base class for field_timer_text formatter.

Code

protected function granularitySettingsSummary($granularity_type, $granularity_auto, $granularity_manual) {
  $granularity_types = $this
    ->granularityTypes();
  switch ($granularity_type) {
    case 'auto':
      $granularity = $granularity_auto;
      break;
    case 'manual':
      $granularity = array();
      $granularity_manual_options = $this
        ->formatterGranularityManual();
      foreach ($granularity_manual as $key => $value) {
        if ($value) {
          $granularity[] = $granularity_manual_options[$key];
        }
      }
      $granularity = implode(', ', $granularity);
      break;
  }
  return array(
    '%granularity_type' => $granularity_types[$granularity_type],
    '%granularity' => $granularity,
  );
}