You are here

function spaces_init_space in Spaces 6.3

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

Initialize a space and set it to be the current active space.

2 calls to spaces_init_space()
spaces_ahah_check in ./spaces.module
Examine the current request to see if it is a submission of a form built inside a space.
spaces_user_init in spaces_user/spaces_user.module
Implementation of hook_init().
2 string references to 'spaces_init_space'
spaces_og_purl_provider in spaces_og/spaces_og.module
Implementation of hook_purl_provider().
spaces_taxonomy_purl_provider in spaces_taxonomy/spaces_taxonomy.module
Implementation of hook_purl_provider().

File

./spaces.module, line 38

Code

function spaces_init_space($type, $id) {
  $space = spaces_load($type, $id);
  if ($space) {
    if ($space
      ->activate()) {

      // If there is already an active space we need to deactivate it.
      // Note that this often causes a redirect.
      if ($active = spaces_get_space()) {
        if ($active->type != $space->type || $active->id != $space->id) {
          $active
            ->deactivate();
        }
      }
      spaces_set_space($space);
    }
    else {
      $space
        ->deactivate();
    }
  }
}