Ejemplo n.º 1
0
 /**
  * Set options
  *
  * Intercept checked and unchecked values and set them early; test stored
  * value against checked and unchecked values after configuration.
  *
  * @param  array $options
  * @return \Zend\Form\Element\Checkbox
  */
 public function setOptions(array $options)
 {
     if (array_key_exists('checkedValue', $options)) {
         $this->setCheckedValue($options['checkedValue']);
         unset($options['checkedValue']);
     }
     if (array_key_exists('uncheckedValue', $options)) {
         $this->setUncheckedValue($options['uncheckedValue']);
         unset($options['uncheckedValue']);
     }
     parent::setOptions($options);
     $curValue = $this->getValue();
     $test = array($this->getCheckedValue(), $this->getUncheckedValue());
     if (!in_array($curValue, $test)) {
         $this->setValue($curValue);
     }
     return $this;
 }