You are here

function calendar_menu in Calendar 5.2

Same name and namespace in other branches
  1. 5 calendar.module \calendar_menu()
  2. 7.3 calendar.module \calendar_menu()

Implementation of hook_menu().

File

./calendar.module, line 21
Adds calendar filtering and displays to Views.

Code

function calendar_menu($may_cache) {
  $items = array();
  if (!$may_cache) {
    drupal_add_css(drupal_get_path('module', 'calendar') . '/calendar.css');
    define('CALENDAR_EMPTY_ARG', variable_get('calendar_empty_arg', 'all'));
    require_once './' . drupal_get_path('module', 'calendar') . '/calendar_admin.inc';
    $first = TRUE;
    foreach (calendar_info() as $view_name => $view) {
      if ($first) {
        $items[] = array(
          'path' => 'admin/settings/calendar',
          'title' => t('Calendar Setup'),
          'description' => t('Customize calendar settings options.'),
          'access' => user_access('administer views'),
          'type' => MENU_NORMAL_ITEM,
          'callback' => 'drupal_get_form',
          'callback arguments' => array(
            '_calendar_setup_form',
            $view_name,
          ),
        );
      }
      $items[] = array(
        'path' => 'admin/settings/calendar/' . $view_name,
        'title' => $view_name,
        'access' => user_access('administer views'),
        'callback' => 'drupal_get_form',
        'callback arguments' => array(
          '_calendar_setup_form',
          $view_name,
        ),
        'type' => $first ? MENU_DEFAULT_LOCAL_TASK : MENU_LOCAL_TASK,
      );
      $items[] = array(
        'path' => 'admin/settings/calendar/' . $view_name . '/setup',
        'title' => t('Setup'),
        'access' => user_access('administer views'),
        'callback' => 'drupal_get_form',
        'callback arguments' => array(
          '_calendar_setup_form',
          $view_name,
        ),
        'type' => MENU_DEFAULT_LOCAL_TASK,
        'weight' => -10,
      );
      $items[] = array(
        'path' => 'admin/settings/calendar/' . $view_name . '/legend',
        'title' => t('Legend'),
        'access' => user_access('administer views'),
        'callback' => 'drupal_get_form',
        'callback arguments' => array(
          '_calendar_legend_form',
          $view_name,
        ),
        'type' => MENU_LOCAL_TASK,
        'weight' => -5,
      );
      $first = FALSE;
    }
  }
  return $items;
}