You are here

function spaces_load in Spaces 7.3

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 spaces.module \spaces_load()

Spaces loader.

18 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_get_space_from_object in ./spaces.module
Get the space that an $object is in.
spaces_init_space in ./spaces.module
Initialize a space and set it to be the current active space.

... 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];
}