本文整理匯總了PHP中Zend_Form::setOptions方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Form::setOptions方法的具體用法?PHP Zend_Form::setOptions怎麽用?PHP Zend_Form::setOptions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend_Form
的用法示例。
在下文中一共展示了Zend_Form::setOptions方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: create
/**
* @param array $config
* @param array $params
* @return ZF1
*/
public function create(array $config, array $params)
{
$form = new ZF1();
$formComponent = new \Zend_Form();
$formComponent->setOptions($config['form']);
foreach ($this->getActiveGroups($config['groups'], $params) as $groupConfig) {
foreach ($groupConfig['elements'] as $elementConfig) {
$element = $this->getDic()->get('form.element.zf1factory')->create($elementConfig, $params);
$formComponent->addElement($element);
}
}
$form->setFormComponent($formComponent);
return $form;
}
示例2: setOptions
public function setOptions(array $options)
{
if (isset($options['model'])) {
$this->_model = $options['model'];
}
//adapter must be set after the model
if (isset($options['adapter'])) {
$this->setAdapter($options['adapter']);
}
if (isset($options['ignoreFields'])) {
$this->setIgnoreFields($options['ignoreFields']);
}
if (isset($options['columnTypes'])) {
$this->setColumnTypes($options['columnTypes']);
}
if (isset($options['fieldLabels'])) {
$this->setFieldLabels($options['fieldLabels']);
}
if (isset($options['fieldTypes'])) {
$this->setFieldTypes($options['fieldTypes']);
}
if (isset($options['generateManyFields'])) {
$this->setGenerateManyFields($options['generateManyFields']);
}
parent::setOptions($options);
}
示例3: setOptions
/**
* Set form state from options array
*
* @return Zend_Form
*/
public function setOptions()
{
$options = $this->_getOptions()->toArray();
if (isset($options['importDisplayGroups'])) {
$this->_extraDisplayGroups = $options['importDisplayGroups'];
unset($options['importDisplayGroups']);
}
if (!isset($options['id'])) {
$id = $this->_module . '-' . $this->_formConfigFile . '-form';
$id = Zend_Filter::filterStatic($id, 'DashToCamelCase') . mt_rand();
$id = lcfirst($id);
$options['id'] = $id;
}
parent::setOptions($options);
return $this;
}