You are here

function homebox_menu in Homebox 6

Same name and namespace in other branches
  1. 6.3 homebox.module \homebox_menu()
  2. 6.2 homebox.module \homebox_menu()
  3. 7.3 homebox.module \homebox_menu()
  4. 7.2 homebox.module \homebox_menu()

Implementation of hook_menu().

File

./homebox.module, line 20
Home box main file, takes care of global functions settings constants, etc.

Code

function homebox_menu() {
  $items = array();

  // User pages
  if (is_array(homebox_pages()) && count(homebox_pages()) > 0) {
    foreach (homebox_pages() as $page) {
      $items['homebox/' . $page->pid] = array(
        'title' => $page->name,
        'page callback' => 'homebox_build',
        'page arguments' => array(
          1,
        ),
        'access arguments' => array(
          'access homebox ' . $page->safe_name,
        ),
        'type' => MENU_NORMAL_ITEM,
      );
    }
  }

  // Ajax Callbacks
  $items['homebox/save'] = array(
    'page callback' => 'homebox_save_user_settings',
    'access callback' => '_homebox_user_access_current_homebox',
    'type' => MENU_CALLBACK,
  );
  $items['homebox/save-color'] = array(
    'page callback' => 'homebox_save_user_color',
    'access callback' => '_homebox_user_access_current_homebox',
    'type' => MENU_CALLBACK,
  );
  $items['homebox/save-open'] = array(
    'page callback' => 'homebox_save_user_open',
    'access callback' => '_homebox_user_access_current_homebox',
    'type' => MENU_CALLBACK,
  );

  // Admin related tasks
  $items['admin/build/homebox'] = array(
    'title' => 'Home box',
    'description' => 'List, edit, or add home box pages.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'homebox_admin_new_page',
    ),
    'access arguments' => array(
      'administer homebox',
    ),
    'file' => 'homebox.admin.inc',
  );
  $items['admin/build/homebox/edit'] = array(
    'title' => 'Edit page',
    'page arguments' => array(
      'homebox_admin_page',
    ),
    'access arguments' => array(
      'administer homebox',
    ),
    'type' => MENU_CALLBACK,
    'file' => 'homebox.admin.inc',
  );
  $items['admin/build/homebox/layout/%'] = array(
    'title' => 'Layout',
    'description' => 'Edit layout.',
    'page callback' => 'homebox_layout',
    'page arguments' => array(
      4,
    ),
    'access arguments' => array(
      'administer homebox',
    ),
    'file' => 'homebox.admin.inc',
    'type' => MENU_CALLBACK,
  );
  $items['admin/build/homebox/settings/%'] = array(
    'title' => 'Settings',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'homebox_configure_form',
      4,
    ),
    'access arguments' => array(
      'administer homebox',
    ),
    'type' => MENU_CALLBACK,
    'file' => 'homebox.admin.inc',
  );
  return $items;
}