You are here

function calendar_ical_menu in Calendar 5

Same name and namespace in other branches
  1. 5.2 calendar_ical.module \calendar_ical_menu()

Implementation of hook_menu().

File

./calendar_ical.module, line 11
Adds ical functionality to Calendar.

Code

function calendar_ical_menu($may_cache) {
  include_once drupal_get_path('module', 'calendar') . '/calendar.theme';
  drupal_add_css(drupal_get_path('module', 'calendar') . '/calendar.css');
  $items = array();
  if (!$may_cache) {
    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) . '/ical',
        'title' => t('iCal'),
        'description' => t('iCal setup.'),
        'access' => user_access('administer views'),
        'callback' => 'drupal_get_form',
        'callback arguments' => array(
          'calendar_ical_setup_form',
          $view_name,
        ),
        'type' => MENU_LOCAL_TASK,
        'weight' => 6,
      );
    }
  }
  return $items;
}