You are here

function spaces_load in Spaces 7

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

Spaces loader.

14 calls to spaces_load()
SpacesContextControllerTestCase::test in tests/spaces.test
Test override inheritance of variable controller.
SpacesVariableControllerTestCase::test in tests/spaces.test
Test override inheritance of variable controller.
spaces_dashboard_access_user in spaces_dashboard/spaces_dashboard.module
Access callback for the user Dashboard.
spaces_init_space in ./spaces.module
Initialize a space and set it to be the current active space.
spaces_og_form_group_submit in spaces_og/spaces_og.module
Group form submit handler.

... See full list

File

./spaces.module, line 10

Code

function spaces_load($type, $id, $reset = FALSE) {
  static $spaces = array();
  if (!isset($spaces[$type][$id]) || $reset) {
    $spaces[$type][$id] = FALSE;
    ctools_include('plugins');
    $registry = spaces_types();
    $info = $registry[$type];
    $plugins = ctools_get_plugins('spaces', 'plugins');
    if (isset($plugins[$info['plugin']]) && ($class = ctools_plugin_get_class($plugins[$info['plugin']], 'handler'))) {
      $space = new $class($type, $id);
      if ($space
        ->load()) {
        $spaces[$type][$id] = $space;
      }
    }
  }
  return $spaces[$type][$id];
}