You are here

function twitter_block_menu in Twitter Block 7

Same name and namespace in other branches
  1. 7.2 twitter_block.module \twitter_block_menu()

Implements hook_menu().

File

./twitter_block.module, line 21
A module to provide simple Twitter blocks using the Twitter Search API.

Code

function twitter_block_menu() {

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

  // Add a local action to the block configuration page
  $items['admin/structure/block/add-twitter-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-twitter-block'] = array(
        'access callback' => '_twitter_block_themes_access',
        'access arguments' => array(
          $theme,
        ),
      ) + $settings;
    }
  }
  $items['admin/structure/block/administer/%/%/delete'] = array(
    'title' => 'Delete Twitter block',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'twitter_block_delete',
      4,
      5,
    ),
    'access arguments' => array(
      'administer blocks',
    ),
    'type' => MENU_CALLBACK,
    'file' => 'twitter_block.admin.inc',
  );
  return $items;
}