You are here

function spaces_menu_alter in Spaces 6.2

Same name and namespace in other branches
  1. 6.3 spaces.module \spaces_menu_alter()
  2. 7.3 spaces.module \spaces_menu_alter()
  3. 7 spaces.module \spaces_menu_alter()

Implementation of hook_menu_alter().

File

./spaces.module, line 142

Code

function spaces_menu_alter(&$items) {
  $router_items = array(
    'node/%node',
    'node/%node/edit',
    'user/%user/view',
    'user/%user_uid_optional',
    'user/%user_category/edit',
  );
  foreach (node_get_types('types', NULL, TRUE) as $type) {
    $type_url_str = str_replace('_', '-', $type->type);
    $router_items[] = 'node/add/' . $type_url_str;
  }
  foreach ($router_items as $path) {
    if (isset($items[$path])) {
      $arguments = isset($items[$path]['access arguments']) ? $items[$path]['access arguments'] : array();
      $arguments[] = isset($items[$path]['access callback']) ? $items[$path]['access callback'] : NULL;
      $items[$path]['access callback'] = 'spaces_menu_access';
      $items[$path]['access arguments'] = $arguments;
    }
  }
}