You are here

function spaces_router in Spaces 6.2

Same name and namespace in other branches
  1. 5.2 spaces.module \spaces_router()
  2. 5 spaces.module \spaces_router()
  3. 6.3 spaces.module \spaces_router()
  4. 6 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.

3 calls to spaces_router()
spaces_init in ./spaces.module
Implementation of hook_init().
spaces_nodeapi in ./spaces.module
Implementation of hook_nodeapi().
spaces_user in ./spaces.module
Implementation of hook_user().

File

./spaces.module, line 924

Code

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

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

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

    // Run each non-active space type's router
    foreach ($types as $type => $info) {
      call_user_func(array(
        $info['class'],
        'router',
      ), $op, $object, FALSE);
    }
  }
}