function spaces_router in Spaces 7
Same name and namespace in other branches
- 5.2 spaces.module \spaces_router()
- 5 spaces.module \spaces_router()
- 6.3 spaces.module \spaces_router()
- 6 spaces.module \spaces_router()
- 6.2 spaces.module \spaces_router()
- 7.3 spaces.module \spaces_router()
Calls the router method on all space types, giving them a chance to route requests accordingly.
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.
2 calls to spaces_router()
- spaces_init in ./
spaces.module - Implements hook_init().
- spaces_menu_access in ./
spaces.module - Spaces menu access callback. Allows space types to manage access as related to their space workflow. See hook_menu_alter() for how menu access callbacks / arguments get passed.
File
- ./
spaces.module, line 373
Code
function spaces_router($op, $object = NULL) {
static $router;
if (!isset($router)) {
$router = array();
// Add the active space.
if ($space = spaces_get_space()) {
$router[$space->type] = $space;
}
// Iterate over space types and create instances of each.
ctools_include('plugins');
$plugins = ctools_get_plugins('spaces', 'plugins');
foreach (spaces_types() as $type => $info) {
if (!isset($router[$type]) && isset($plugins[$info['plugin']]) && ($class = ctools_plugin_get_class($plugins[$info['plugin']], 'handler'))) {
$router[$type] = new $class($type);
}
}
}
foreach ($router as $space) {
$space
->router($op, $object);
}
}