/** * Check whether we find a value for this option in the array pulled from * the database. If so adopt this value. Pass the array on to all the children * such that they can do the same. * * @param array $storedOptions Array pulled from database. * @access public */ function load($storedOptions) { if (is_array($storedOptions)) { if (array_key_exists($this->_name, $storedOptions)) { $this->setValue($storedOptions[$this->_name]); } parent::load($storedOptions); } elseif ($storedOptions) { //option was not stored in an associative array $this->setValue($storedOptions); } }
/** * Check whether we find a value for this option in the array pulled from * the database. If so adopt this value. Pass the array on to all the children * such that they can do the same. * * @param array $storedOptions Array pulled from database. * @access public */ function load($storedOptions) { if (is_array($storedOptions)) { if (array_key_exists($this->getName(), $storedOptions)) { $this->setValue($storedOptions[$this->getName()]); } //register all ImageSizes that can be added/removed on runtime foreach ($this->getValue() as $key => $value) { //only add if not yet there and removable if (!$this->getOptionByName($key) && $value) { $this->addChild(new ImageSizeOption($key, '1')); } } parent::load($storedOptions); } }