You are here

function partial_date_menu in Partial Date 7

Implements hook_menu().

File

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

Code

function partial_date_menu() {
  $counter = 0;
  foreach (partial_date_format_types() as $type => $label) {
    if (!$counter) {
      $items['admin/config/regional/date-time/partial-date-formats'] = array(
        'title' => t('Partial date formats'),
        'page callback' => 'drupal_get_form',
        'page arguments' => array(
          'partial_date_format_settings_form',
          $type,
        ),
        'access arguments' => array(
          'administer site configuration',
        ),
        'type' => MENU_LOCAL_TASK,
        'file' => 'partial_date.pages.inc',
      );
      $items['admin/config/regional/date-time/partial-date-formats/' . $type] = array(
        'title' => $label,
        'type' => MENU_DEFAULT_LOCAL_TASK,
        'weight' => $counter++,
      );
    }
    else {
      $items['admin/config/regional/date-time/partial-date-formats/' . $type] = array(
        'title' => $label,
        'page callback' => 'drupal_get_form',
        'page arguments' => array(
          'partial_date_format_settings_form',
          $type,
        ),
        'access arguments' => array(
          'administer site configuration',
        ),
        'type' => $counter ? MENU_LOCAL_TASK : MENU_DEFAULT_LOCAL_TASK,
        'file' => 'partial_date.pages.inc',
        'weight' => $counter++,
      );
    }
  }
  return $items;
}