You are here

class spaces_controller_variable in Spaces 6.3

Same name and namespace in other branches
  1. 7.3 plugins/spaces_controller_variable.inc \spaces_controller_variable
  2. 7 plugins/spaces_controller_variable.inc \spaces_controller_variable

Variable controller.

Hierarchy

Expanded class hierarchy of spaces_controller_variable

3 string references to 'spaces_controller_variable'
spaces_customtext_spaces_plugins in spaces_customtext/spaces_customtext.module
Implementation of hook_spaces_plugins().
spaces_spaces_plugins in ./spaces.module
Implementation of hook_spaces_plugins().
spaces_spaces_registry in ./spaces.module
Implementation of hook_spaces_registry().

File

plugins/spaces_controller_variable.inc, line 6

View source
class spaces_controller_variable extends spaces_controller {

  /**
   * Override of init_overrides().
   */
  function init_overrides() {

    // Load original variables. Only do this once, and it may not be reset.
    $this
      ->load_original_values();

    // Load the preset values.
    $this
      ->reset_values('preset');
    $this
      ->load_preset_values();

    // Load space variables.
    $this
      ->reset_values('space');
    $this
      ->load_space_values();

    // Alter global variable conf as we don't have any other way of
    // influencing the result of variable_get().
    global $conf;
    $conf = $this
      ->get();

    // If we have overridden 'site_frontpage', we need to do some extra
    // work to reinit the drupal path.
    if ($this
      ->get('site_frontpage') !== $this
      ->get('site_frontpage', 'original') && function_exists('purl_language_strip')) {
      $_GET['q'] = purl_language_strip($_REQUEST['q']);
      drupal_init_path();
    }
  }

  /**
   * Override of load_preset_values(). We cannot rely on variable_get() --
   * we must first check our space override values.
   */
  protected function load_preset_values($id = NULL) {
    if (empty($this->loaded_all['preset'])) {
      $preset_name = $this
        ->get("spaces_preset_{$this->space_type}", 'space') ? $this
        ->get("spaces_preset_{$this->space_type}", 'space') : variable_get("spaces_preset_{$this->space_type}", NULL);
      if ($preset_name && ($preset = spaces_preset_load($preset_name))) {
        if (isset($preset->value[$this->controller])) {
          $this->values['preset'] = $preset->value[$this->controller];
        }
      }
      $this->loaded_all['preset'] = TRUE;
    }
  }

  /**
   * Override of load_original_values().
   */
  protected function load_original_values($id = NULL) {
    global $conf;
    if (empty($this->values['original'])) {
      $this->values['original'] = $conf;
      $this->loaded_all['original'] = TRUE;
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
spaces_controller::$controller property
spaces_controller::$loaded protected property
spaces_controller::$loaded_all protected property
spaces_controller::$space_id property
spaces_controller::$space_type property
spaces_controller::$values property
spaces_controller::del function Delete a controller object override for this space.
spaces_controller::get function Get a value for this controller.
spaces_controller::load_space_values protected function Protected method that ensures a space-level override for the provided object has been loaded. 1
spaces_controller::load_values protected function Wrapper around load_[environment]_values.
spaces_controller::reset_values protected function Clear out loaded values.
spaces_controller::set function Set override values for a given controller object in this space.
spaces_controller::summary function Provide a readable display of an object override for administration.
spaces_controller::__construct function
spaces_controller_variable::init_overrides function Override of init_overrides(). Overrides spaces_controller::init_overrides 1
spaces_controller_variable::load_original_values protected function Override of load_original_values(). Overrides spaces_controller::load_original_values
spaces_controller_variable::load_preset_values protected function Override of load_preset_values(). We cannot rely on variable_get() -- we must first check our space override values. Overrides spaces_controller::load_preset_values