You are here

protected function spaces_controller_boxes::load_original_values in Boxes 7

Same name and namespace in other branches
  1. 6 plugins/spaces_controller_boxes.inc \spaces_controller_boxes::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;
    }
    elseif (!isset($this->loaded['original'][$id])) {
      if ($box = ctools_export_load_object('box', 'names', array(
        $id,
      ))) {
        $this->values['original'][$id] = reset($box);
        $this->loaded['original'][$id] = TRUE;
      }
    }
  }
}