You are here

function partial_date_format_default_options in Partial Date 7

Provides the default settiings for the partial date formats.

1 call to partial_date_format_default_options()
partial_date_format_settings in ./partial_date.module

File

./partial_date.module, line 617
Defines a date element that allows for any combination of date granularity settings.

Code

function partial_date_format_default_options($format) {
  $formats = array(
    'short' => array(
      'display' => array(
        'year' => 'estimate_label',
        'month' => 'estimate_label',
        'day' => 'estimate_label',
        'hour' => 'estimate_label',
        'minute' => 'estimate_label',
        'second' => 'none',
        'timezone' => 'none',
      ),
      'components' => array(
        'approx' => array(
          'value' => '',
          'weight' => -1,
        ),
        'year' => array(
          'format' => 'y-ce',
          'weight' => 0,
          'empty' => '',
        ),
        'month' => array(
          'format' => 'm',
          'weight' => 1,
          'empty' => '',
        ),
        'day' => array(
          'format' => 'j',
          'weight' => 2,
          'empty' => '',
        ),
        'hour' => array(
          'format' => 'H',
          'weight' => 3,
          'empty' => '',
        ),
        'minute' => array(
          'format' => 'i',
          'weight' => 4,
          'empty' => '',
        ),
        'second' => array(
          'format' => 's',
          'weight' => 5,
          'empty' => '',
        ),
        'timezone' => array(
          'format' => 'T',
          'weight' => 6,
          'empty' => '',
        ),
        'c1' => array(
          'value' => '',
          'weight' => 7,
        ),
        'c2' => array(
          'value' => '',
          'weight' => 8,
        ),
        'c3' => array(
          'value' => '',
          'weight' => 9,
        ),
      ),
      'separator' => array(
        'date' => '/',
        'time' => ':',
        'datetime' => ' ',
        'other' => ' ',
        'range' => '',
      ),
      'meridiem' => 'a',
      'year_designation' => 'ce',
    ),
    'medium' => array(
      'display' => array(
        'year' => 'estimate_label',
        'month' => 'estimate_label',
        'day' => 'estimate_label',
        'hour' => 'estimate_label',
        'minute' => 'estimate_label',
        'second' => 'estimate_label',
        'timezone' => 'date_only',
      ),
      'components' => array(
        'approx' => array(
          'value' => '',
          'weight' => -1,
        ),
        'year' => array(
          'format' => 'Y-ce',
          'weight' => 0,
          'empty' => '',
        ),
        'month' => array(
          'format' => 'M',
          'weight' => 1,
          'empty' => '',
        ),
        'day' => array(
          'format' => 'j-S',
          'weight' => 2,
          'empty' => '',
        ),
        'hour' => array(
          'format' => 'h',
          'weight' => 3,
          'empty' => '',
        ),
        'minute' => array(
          'format' => 'i',
          'weight' => 4,
          'empty' => '',
        ),
        'second' => array(
          'format' => 's',
          'weight' => 5,
          'empty' => '',
        ),
        'timezone' => array(
          'format' => 'T',
          'weight' => 6,
          'empty' => '',
        ),
        'c1' => array(
          'value' => '',
          'weight' => 7,
        ),
        'c2' => array(
          'value' => '',
          'weight' => 8,
        ),
        'c3' => array(
          'value' => '',
          'weight' => 9,
        ),
      ),
      'separator' => array(
        'date' => ' ',
        'time' => ':',
        'datetime' => ' ',
        'other' => ' ',
        'range' => '',
      ),
      'meridiem' => 'a',
      'year_designation' => 'ce',
    ),
    'long' => array(
      'display' => array(
        'year' => 'estimate_label',
        'month' => 'estimate_label',
        'day' => 'estimate_label',
        'hour' => 'estimate_label',
        'minute' => 'estimate_label',
        'second' => 'estimate_label',
        'timezone' => 'date_only',
      ),
      'components' => array(
        'approx' => array(
          'value' => '',
          'weight' => -1,
        ),
        'year' => array(
          'format' => 'Y-ce',
          'weight' => 0,
          'empty' => '',
        ),
        'month' => array(
          'format' => 'F',
          'weight' => 1,
          'empty' => '',
        ),
        'day' => array(
          'format' => 'j-S',
          'weight' => 2,
          'empty' => '',
        ),
        'hour' => array(
          'format' => 'h',
          'weight' => 3,
          'empty' => '',
        ),
        'minute' => array(
          'format' => 'i',
          'weight' => 4,
          'empty' => '',
        ),
        'second' => array(
          'format' => 's',
          'weight' => 5,
          'empty' => '',
        ),
        'timezone' => array(
          'format' => 'e',
          'weight' => 6,
          'empty' => '',
        ),
        'c1' => array(
          'value' => '',
          'weight' => 7,
        ),
        'c2' => array(
          'value' => '',
          'weight' => 8,
        ),
        'c3' => array(
          'value' => '',
          'weight' => 9,
        ),
      ),
      'separator' => array(
        'date' => ' ',
        'time' => ':',
        'datetime' => ', ',
        'other' => ' ',
        'range' => '',
      ),
      'meridiem' => 'a',
      'year_designation' => 'ce',
    ),
  );
  if (isset($formats[$format])) {
    return $formats[$format];
  }
  return $formats['short'];
}