You are here

function spaces_init in Spaces 6.2

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

Implementation of hook_init().

File

./spaces.module, line 12

Code

function spaces_init() {

  // This is a rather unfortunate and hackish way to get around
  // module weights.
  // @TODO replace this by eliminating spaces_site and instead
  // making it the base space class.
  if (!spaces_get_space() && module_exists('spaces_site')) {
    module_invoke('spaces_site', 'init');
  }

  // We use a menu callback here rather than drupal_access_denied().
  // Using drupal_access_denied() can terminate the page request before
  // bootstrap completes, leading to all sorts of havoc.
  if (!spaces_menu_access()) {
    menu_set_active_item('spaces-access-denied');
  }
  spaces_router('menu');

  // Rebuild spaces menu on page callbacks where there is the
  // potential for the addition/removal/alteration of features.
  $router_item = menu_get_item();
  switch ($router_item['path']) {
    case 'admin/build/context':
    case 'admin/build/features':
    case 'admin/build/modules':
      spaces_features_map(NULL, TRUE);
      break;
  }
}