You are here

function spaces_router in Spaces 5.2

Same name and namespace in other branches
  1. 5 spaces.module \spaces_router()
  2. 6.3 spaces.module \spaces_router()
  3. 6 spaces.module \spaces_router()
  4. 6.2 spaces.module \spaces_router()
  5. 7.3 spaces.module \spaces_router()
  6. 7 spaces.module \spaces_router()

Wrapper around implementations of $space->router. Provides additional intelligence, including a global killswitch and routing when no spaces are active.

Parameters

$op: The current "hook" or "hook op" identifier for the $space->router to act on.

$object: Optional object to pass to the $space->router.

4 calls to spaces_router()
spaces_form_alter in ./spaces.module
Implementation of hook_form_alter().
spaces_menu in ./spaces.module
Implementation of hook_menu().
spaces_nodeapi in ./spaces.module
Implementation of hook_nodeapi().
spaces_user in ./spaces.module
Implementation of hook_user().

File

./spaces.module, line 882

Code

function spaces_router($op, $object = NULL) {

  // Check global killswitch
  if (spaces_router_get()) {
    $access = true;
    $types = spaces_types();

    // Run the router for the active space
    if ($space = spaces_get_space()) {
      $access = $access && $space
        ->router($op, $object);
      unset($types[$space->type]);
    }

    // Run each non-active space type's router
    foreach ($types as $type => $info) {
      $access = $access && call_user_func(array(
        $info['class'],
        'router',
      ), $op, $object, FALSE);
    }
    if (!$access && !user_access('administer spaces')) {
      drupal_access_denied();
      exit;
    }
  }
}