本文整理汇总了PHP中Zend_Form_Element_Xhtml::setOptions方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element_Xhtml::setOptions方法的具体用法?PHP Zend_Form_Element_Xhtml::setOptions怎么用?PHP Zend_Form_Element_Xhtml::setOptions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form_Element_Xhtml
的用法示例。
在下文中一共展示了Zend_Form_Element_Xhtml::setOptions方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setOptions
/**
* 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: setOptions
/**
* 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;
}
示例3: setOptions
/**
* 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;
}