You are here

function spaces_active_space_menu in Spaces 6

Same name and namespace in other branches
  1. 5.2 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.

3 calls to spaces_active_space_menu()
spaces_site_menu in spaces_site/spaces_site.module
Implementation of hook_menu().
spaces_taxonomy_menu in spaces_taxonomy/spaces_taxonomy.module
Implementation of hook_menu().
spaces_user_menu in spaces_user/spaces_user.module
Implementation of hook_menu().

File

./spaces.module, line 1633

Code

function spaces_active_space_menu($type, $local_tasks = FALSE, $path_prefix = '') {
  $types = spaces_types();
  $path_prefix = !empty($path_prefix) ? $path_prefix . '/' : '';
  if ($local_tasks == FALSE) {
    $items[$path_prefix . 'spaces'] = array(
      'title' => t('!space_type settings', array(
        '!space_type' => $types[$type]['title'],
      )),
      'page callback' => 'drupal_get_form',
      'page arguments' => array(
        'spaces_basic_form',
      ),
      'access callback' => 'spaces_admin_access',
      'access arguments' => array(
        $type,
      ),
      'type' => MENU_NORMAL_ITEM,
    );
  }
  else {
    $items[$path_prefix . 'spaces'] = array(
      'title' => t('Spaces'),
      'page callback' => 'drupal_get_form',
      'page arguments' => array(
        'spaces_basic_form',
      ),
      'access callback' => 'spaces_admin_access',
      'access arguments' => array(
        $type,
      ),
      'type' => MENU_LOCAL_TASK,
      'weight' => 1,
    );
  }
  $items[$path_prefix . 'spaces/setup'] = array(
    'title' => t('Basic setup'),
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'spaces_basic_form',
    ),
    'access callback' => 'spaces_admin_access',
    'access arguments' => array(
      $type,
    ),
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => 0,
  );
  $items[$path_prefix . 'spaces/features'] = array(
    'title' => t('Features'),
    'page callback' => 'spaces_features_page',
    'page arguments' => array(),
    'access callback' => 'spaces_admin_access',
    'access arguments' => array(
      $type,
      'features',
    ),
    'type' => MENU_LOCAL_TASK,
    'weight' => 1,
  );
  return $items;
}