You are here

function spaces_set_space in Spaces 6

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

Sets the specified space as the current active space. Returns the active space if no space is provided.

Parameters

$space: The space object to set as the active space. Optional.

$reset: Optional flag to reset the static cache.

Return value

The active space object or FALSE if there is no active space.

3 calls to spaces_set_space()
spaces_get_space in ./spaces.module
Wrapper function around spaces_set_space(). Retrieves the current active space.
spaces_init_context in ./spaces.module
Context prefix provider callback.
spaces_site_init in spaces_site/spaces_site.module
Implementation of hook_init().

File

./spaces.module, line 1220

Code

function spaces_set_space($space = NULL, $reset = FALSE) {
  static $current_space;
  if (!isset($current_space) || $reset) {
    $current_space = $space;
    if ($space) {

      // Context integration with spaces_type setter.
      context_set_by_condition('spaces_type', $space->type);
    }
  }
  return $current_space ? $current_space : FALSE;
}