本文整理匯總了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;
}