예제 #1
0
파일: Checkbox.php 프로젝트: rikaix/zf2
 /**
  * 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;
 }
예제 #2
0
파일: Captcha.php 프로젝트: rexmac/zf2
 /**
  * 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;
 }
예제 #3
0
 /**
  * Set object state from options array
  *
  * @param  array $options
  * @return \Zend\Form\Element\File
  */
 public function setOptions(array $options)
 {
     parent::setOptions($options);
     $adapter = $this->getTransferAdapter();
     $adapter->setOptions($options);
     return $this;
 }