You are here

function calendar_menu in Calendar 5

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

Implementation of hook_menu().

File

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

Code

function calendar_menu($may_cache) {
  $items = array();
  if (!$may_cache) {
    include_once './' . drupal_get_path('module', 'calendar') . '/calendar.theme';
    drupal_add_css(drupal_get_path('module', 'calendar') . '/calendar.css');
    define('CALENDAR_EMPTY_ARG', variable_get('calendar_empty_arg', 'all'));
    foreach (calendar_info() as $view_name => $view) {
      $parts = explode('/', $view['url']);
      foreach ($parts as $delta => $part) {
        if (in_array($part, array(
          '$arg',
          '$node',
          '$user',
          '$group',
        ))) {
          $parts[$delta] = arg($delta);
        }
      }
      $items[] = array(
        'path' => implode('/', $parts) . '/setup',
        'title' => t('Setup'),
        'description' => t('Calendar setup.'),
        'access' => user_access('administer views'),
        'callback' => 'drupal_get_form',
        'callback arguments' => array(
          'calendar_setup_form',
          $view_name,
        ),
        'type' => MENU_LOCAL_TASK,
        'weight' => 5,
      );
    }
  }
  return $items;
}