class space in Spaces 7
Same name and namespace in other branches
- 6.3 plugins/space.inc \space
- 7.3 plugins/space.inc \space
Base class describing a space.
Provides methods for:
- Instantiating & loading a space by its type & id
- Activating a space
- Deactivating a space
- Accessing controllers
Hierarchy
- class \space
Expanded class hierarchy of space
14 string references to 'space'
- 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_controller::get in plugins/spaces_controller.inc 
- Get a value for this controller.
- spaces_controller::init_overrides in plugins/spaces_controller.inc 
- Initialize overrides. Assume this controller is now active. This method is re-run when the caller wants to ensure the values provided by the controller are refreshed.
- spaces_controller::load_values in plugins/spaces_controller.inc 
- Wrapper around load_[environment]_values.
File
- plugins/space.inc, line 12 
View source
class space {
  var $controllers;
  var $type;
  var $id;
  var $active;
  /**
   * Constructor.
   */
  function __construct($type, $id = NULL) {
    $this->type = $type;
    $this->id = $id;
    $this
      ->get_controllers();
  }
  /**
   * Extending classes can use this method to load any associated data or
   * objects. Return FALSE to abort the load process.
   */
  function load() {
    return TRUE;
  }
  /**
   * Called from spaces_init_space(). Determine whether this space can be set
   * as the current active space. Override to provide custom logic for bailing
   * the spaces bootstrap.
   */
  function activate() {
    $this->active = TRUE;
    $this
      ->init_overrides();
    return TRUE;
  }
  /**
   * Called when this space should be deactivated. If a space type uses a PURL
   * modifier to be instantiated, this is the time to remove that condition.
   * Other spaces may need to remove their custom conditions need to be at this
   * point.
   */
  function deactivate() {
    return;
  }
  /**
   * Instantiate controllers for this space.
   */
  protected function get_controllers() {
    // Create instances of each controller.
    if (!isset($this->controllers)) {
      $this->controllers = new stdClass();
      module_load_include('inc', 'spaces', 'spaces.overrides');
      ctools_include('plugins');
      $plugins = ctools_get_plugins('spaces', 'plugins');
      foreach (spaces_controllers() as $c => $info) {
        if (isset($plugins[$info['plugin']]) && ($class = ctools_plugin_get_class($plugins[$info['plugin']], 'handler'))) {
          $this->controllers->{$c} = new $class($c, $this->type, $this->id);
        }
      }
    }
  }
  /**
   * Initialize any overrides as necessary.
   */
  function init_overrides() {
    foreach (spaces_controllers() as $c => $info) {
      if (isset($this->controllers->{$c})) {
        $this->controllers->{$c}
          ->init_overrides();
      }
    }
  }
}Members
| Name   | Modifiers | Type | Description | Overrides | 
|---|---|---|---|---|
| space:: | property | |||
| space:: | property | |||
| space:: | property | |||
| space:: | property | |||
| space:: | function | Called from spaces_init_space(). Determine whether this space can be set as the current active space. Override to provide custom logic for bailing the spaces bootstrap. | 1 | |
| space:: | function | Called when this space should be deactivated. If a space type uses a PURL modifier to be instantiated, this is the time to remove that condition. Other spaces may need to remove their custom conditions need to be at this point. | 2 | |
| space:: | protected | function | Instantiate controllers for this space. | |
| space:: | function | Initialize any overrides as necessary. | ||
| space:: | function | Extending classes can use this method to load any associated data or objects. Return FALSE to abort the load process. | 3 | |
| space:: | function | Constructor. | 
