You are here

function spaces_frontpage in Spaces 6.3

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

Route the user to the proper homepage for this space.

Assumes that the router path provided in hook_spaces_registry() for the space type describes a path with a loader argument to be replaced by the $space->id. See _menu_router_build() for the origin of the regex.

1 string reference to 'spaces_frontpage'
spaces_menu in ./spaces.module
Implementation of hook_menu().

File

./spaces.module, line 723

Code

function spaces_frontpage() {
  $space = spaces_get_space();
  if ($space) {
    $types = spaces_types();
    $type_info = $types[$space->type];
    if (isset($type_info['path'])) {
      $path = preg_replace('/%(|[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*)$/', $space->id, $type_info['path']);
      menu_set_active_item($path);
      return menu_execute_active_handler();
    }
  }
  drupal_not_found();
  exit;
}