/** * 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; }
/** * Set options * * Overrides to allow passing captcha options * * @param array $options * @return 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; }
/** * Set options * * Overrides to allow passing captcha options * * @param array $options * @return Zend_Form_Element_Captcha */ public function setOptions(array $options) { if (array_key_exists('captcha', $options)) { if (array_key_exists('captchaOptions', $options)) { $this->setCaptcha($options['captcha'], $options['captchaOptions']); unset($options['captchaOptions']); } else { $this->setCaptcha($options['captcha']); } unset($options['captcha']); } parent::setOptions($options); return $this; }