示例#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 IfwPsn_Vendor_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;
 }
示例#2
0
 /**
  * Set options
  *
  * Overrides to allow passing captcha options
  *
  * @param  array $options
  * @return IfwPsn_Vendor_Zend_Form_Element_Captcha
  */
 public function setOptions(array $options)
 {
     $captcha = null;
     $captchaOptions = array();
     if (array_key_exists('captcha', $options)) {
         $captcha = $options['captcha'];
         if (array_key_exists('captchaOptions', $options)) {
             $captchaOptions = $options['captchaOptions'];
             unset($options['captchaOptions']);
         }
         unset($options['captcha']);
     }
     parent::setOptions($options);
     if (null !== $captcha) {
         $this->setCaptcha($captcha, $captchaOptions);
     }
     return $this;
 }