You are here

function spaces_active_space_menu in Spaces 5.2

Same name and namespace in other branches
  1. 6 spaces.module \spaces_active_space_menu()
  2. 6.2 spaces.module \spaces_active_space_menu()

A mild abstraction of hook_menu() items that can be used by implementing modules to embed/graft relevant spaces items into the menu tree. Should only be used when the $may_cache argument of hook_menu() is false.

Parameters

$space: A space object.

$local_tasks: Optional boolean flag for whether the items are fully rendered as local tasks.

$path_prefix: A path to prefix the menu item paths by.

Return value

An array of menu items.

2 calls to spaces_active_space_menu()
spaces_og_menu in ./spaces_og.module
Implementation of hook_menu().
spaces_user_menu in ./spaces_user.module
Implementation of hook_menu().

File

./spaces.module, line 1165

Code

function spaces_active_space_menu($space, $local_tasks = FALSE, $path_prefix = '') {
  include_once drupal_get_path('module', 'spaces') . '/spaces_admin.inc';
  $types = spaces_types();
  $path_prefix = !empty($path_prefix) ? $path_prefix . '/' : '';
  if ($local_tasks == FALSE) {
    $items['spaces'] = array(
      'path' => $path_prefix . 'spaces',
      'title' => t('!space_type settings', array(
        '!space_type' => $types[$space->type]['title'],
      )),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'spaces_basic_form',
        $space,
      ),
      'access' => $space
        ->admin_access(),
      'type' => MENU_NORMAL_ITEM,
    );
  }
  else {
    $items['spaces'] = array(
      'path' => $path_prefix . 'spaces',
      'title' => t('Spaces'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'spaces_basic_form',
        $space,
      ),
      'access' => $space
        ->admin_access(),
      'type' => MENU_LOCAL_TASK,
      'weight' => 1,
    );
  }
  $items['spaces/setup'] = array(
    'path' => $path_prefix . 'spaces/setup',
    'title' => t('Basic setup'),
    'callback' => 'drupal_get_form',
    'callback arguments' => array(
      'spaces_basic_form',
      $space,
    ),
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => 0,
  );
  $items['spaces/features'] = array(
    'path' => $path_prefix . 'spaces/features',
    'title' => t('Features'),
    'callback' => 'drupal_get_form',
    'callback arguments' => array(
      'spaces_features_form',
      $space,
    ),
    'type' => MENU_LOCAL_TASK,
    'weight' => 1,
  );
  $items['spaces/customize'] = array(
    'path' => $path_prefix . 'spaces/customize',
    'title' => t('Customize'),
    'callback' => 'spaces_customize',
    'callback arguments' => array(
      $space,
    ),
    'access' => $space
      ->admin_access(),
    'type' => MENU_LOCAL_TASK,
    'weight' => 2,
  );
  return $items;
}