You are here

protected function spaces_controller_boxes::load_original_values in Boxes 6

Same name and namespace in other branches
  1. 7 plugins/spaces_controller_boxes.inc \spaces_controller_boxes::load_original_values()

Protected method for loading an original object. Must be overridden by extending classes.

Overrides spaces_controller::load_original_values

File

plugins/spaces_controller_boxes.inc, line 9

Class

spaces_controller_boxes
Spaces controller for boxes module.

Code

protected function load_original_values($id = NULL) {
  if (empty($this->loaded_all['original'])) {

    // TODO can we always rely on having export.inc loaded?
    if (!isset($id)) {
      $boxes = array();
      foreach (ctools_export_load_object('box') as $box) {
        $boxes[$box->delta] = $box;
      }
      $this->values['original'] = $boxes;
      $this->loaded_all['original'] = TRUE;
    }
    else {
      if (!isset($this->loaded['original'][$id])) {
        if ($box = array_pop(ctools_export_load_object('box', 'names', array(
          $id,
        )))) {
          $this->values['original'][$id] = $box;
          $this->loaded['original'][$id] = TRUE;
        }
      }
    }
  }
}