You are here

function google_calendar_block_menu in Google Calendar Block 7

Same name and namespace in other branches
  1. 7.2 google_calendar_block.module \google_calendar_block_menu()

Implements hook_menu().

File

./google_calendar_block.module, line 72
A module to provide simple Google Calendar blocks using the Google Data APIs.

Code

function google_calendar_block_menu() {

  // Create an array of block settings.
  $settings = array(
    'title' => 'Add Google Calendar block',
    'description' => 'Add a new Google Calendar block.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'google_calendar_block_add_block_form',
    ),
    'type' => MENU_LOCAL_ACTION,
    'file' => 'google_calendar_block.admin.inc',
  );

  // Add a local action to the block configuration page.
  $items['admin/structure/block/add-google-calendar-block'] = array(
    'access arguments' => array(
      'administer blocks',
    ),
  ) + $settings;

  // Get the default site theme.
  $default_theme = variable_get('theme_default', 'bartik');

  // Add a local action to the per-theme block configuration pages.
  foreach (list_themes() as $key => $theme) {
    if ($key != $default_theme) {
      $items['admin/structure/block/list/' . $key . '/add-google-calendar-block'] = array(
        'access callback' => '_google_calendar_block_themes_access',
        'access arguments' => array(
          $theme,
        ),
      ) + $settings;
    }
  }
  $items['admin/structure/block/administer/google_calendar_block/%/delete'] = array(
    'title' => 'Delete Google Calendar block',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'google_calendar_block_delete',
      5,
    ),
    'access arguments' => array(
      'administer blocks',
    ),
    'type' => MENU_CALLBACK,
    'file' => 'google_calendar_block.admin.inc',
  );
  return $items;
}