You are here

function spaces_dashboard_menu in Spaces 7

Same name and namespace in other branches
  1. 5.2 spaces_dashboard/spaces_dashboard.module \spaces_dashboard_menu()
  2. 5 spaces_dashboard/spaces_dashboard.module \spaces_dashboard_menu()
  3. 6.3 spaces_dashboard/spaces_dashboard.module \spaces_dashboard_menu()
  4. 7.3 spaces_dashboard/spaces_dashboard.module \spaces_dashboard_menu()

Implements hook_menu().

File

spaces_dashboard/spaces_dashboard.module, line 40

Code

function spaces_dashboard_menu() {
  $items = array();
  $items['dashboard'] = array(
    'title' => 'Dashboard',
    'menu_name' => 'features',
    'page callback' => 'spaces_dashboard_page',
    'page arguments' => array(
      'custom-1',
    ),
    'access callback' => 'spaces_dashboard_access',
    'access arguments' => array(
      'feature',
      'custom-1',
      'site',
    ),
    'type' => MENU_NORMAL_ITEM,
  );
  for ($i = 1; $i < 6; $i++) {
    $items["dashboard/custom-{$i}"] = array(
      'title' => 'Dashboard',
      'title callback' => 'spaces_dashboard_title',
      'title arguments' => array(
        "custom-{$i}",
      ),
      'page callback' => 'spaces_dashboard_page',
      'page arguments' => array(
        "custom-{$i}",
      ),
      'access callback' => 'spaces_dashboard_access',
      'access arguments' => array(
        'feature',
        "custom-{$i}",
        'site',
      ),
      'type' => $i === 1 ? MENU_DEFAULT_LOCAL_TASK : MENU_LOCAL_TASK,
      'weight' => $i,
    );
  }
  $items['dashboard/add'] = array(
    'title' => 'Add custom',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'spaces_dashboard_add',
    ),
    'access callback' => 'spaces_dashboard_access',
    'access arguments' => array(
      'admin',
    ),
    'type' => MENU_LOCAL_TASK,
    'weight' => 100,
    'file' => 'spaces_dashboard.admin.inc',
  );
  $items['admin/config/system/dashboard'] = array(
    'title' => 'Dashboard settings',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'spaces_dashboard_admin_form',
    ),
    'access callback' => 'spaces_dashboard_access',
    'access arguments' => array(
      'admin',
    ),
    'file' => 'spaces_dashboard.admin.inc',
    'type' => MENU_NORMAL_ITEM,
  );
  $items['admin/config/system/dashboard/blocks'] = array(
    'title' => 'Block settings',
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );
  $items['admin/config/system/dashboard/regions'] = array(
    'title' => 'Region settings',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'spaces_dashboard_admin_region_form',
    ),
    'access callback' => 'spaces_dashboard_access',
    'access arguments' => array(
      'admin',
    ),
    'file' => 'spaces_dashboard.admin.inc',
    'type' => MENU_LOCAL_TASK,
  );

  // Spaces support.
  if (module_exists('spaces')) {
    $items['features/spaces_dashboard'] = $items['admin/config/system/dashboard'];
    $items['features/spaces_dashboard']['title'] = 'Settings';
    $items['features/spaces_dashboard/block'] = $items['admin/config/system/dashboard/blocks'];
    $items['features/spaces_dashboard/regions'] = $items['admin/config/system/dashboard/regions'];
  }
  if (module_exists('spaces_user')) {
    $items['user/%user/dashboard'] = array(
      'title' => 'Dashboard',
      'title callback' => 'spaces_dashboard_title_user',
      'title arguments' => array(
        1,
      ),
      'page callback' => 'spaces_dashboard_page',
      'page arguments' => array(
        'custom-1',
      ),
      'access callback' => 'spaces_dashboard_access_user',
      'access arguments' => array(
        1,
        'feature',
        'custom-1',
      ),
      'type' => MENU_LOCAL_TASK,
    );
    for ($i = 1; $i < 6; $i++) {
      $items["user/%user/dashboard/custom-{$i}"] = array(
        'title' => 'Dashboard',
        'title callback' => 'spaces_dashboard_title',
        'title arguments' => array(
          "custom-{$i}",
        ),
        'page callback' => 'spaces_dashboard_page',
        'page arguments' => array(
          "custom-{$i}",
        ),
        'access callback' => 'spaces_dashboard_access_user',
        'access arguments' => array(
          1,
          'feature',
          "custom-{$i}",
        ),
        'type' => $i === 1 ? MENU_DEFAULT_LOCAL_TASK : MENU_LOCAL_TASK,
        'weight' => $i,
      );
    }
    $items['user/%user/dashboard/add'] = array(
      'title' => 'Add custom',
      'page callback' => 'drupal_get_form',
      'page arguments' => array(
        'spaces_dashboard_add',
      ),
      'access callback' => 'spaces_dashboard_access_user',
      'access arguments' => array(
        1,
        'admin',
      ),
      'type' => MENU_LOCAL_TASK,
      'weight' => 100,
      'file' => 'spaces_dashboard.admin.inc',
    );
  }
  return $items;
}