本文整理汇总了PHP中CFormModel::getValidators方法的典型用法代码示例。如果您正苦于以下问题:PHP CFormModel::getValidators方法的具体用法?PHP CFormModel::getValidators怎么用?PHP CFormModel::getValidators使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFormModel
的用法示例。
在下文中一共展示了CFormModel::getValidators方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderProperties
/**
* Renders form properties utilizing the appropriate
* @param CActiveForm $form The form we're working with
* @param Property Name $property The property name from Reflection
*/
private function renderProperties(&$form, $property)
{
$htmlOptions = array('class' => 'pure-input-2-3');
$validators = $this->model->getValidators($property->name);
$stringValidators = $this->model->getStringValidator($property->name, $validators);
if (in_array('required', $stringValidators)) {
$htmlOptions['required'] = true;
}
echo CHtml::openTag('div', array('class' => 'pure-control-group'));
if (in_array('boolean', $stringValidators)) {
$form->toggleButtonRow($this->model, $property->name, $htmlOptions, $validators);
} else {
if (in_array('number', $stringValidators) && isset($validators[0]->max) && isset($validators[0]->min)) {
$form->rangeFieldRow($this->model, $property->name, $htmlOptions, $validators);
} else {
if (in_array('number', $stringValidators) && (isset($validators[0]->max) || isset($validators[0]->min))) {
$form->numberFieldRow($this->model, $property->name, $htmlOptions, $validators);
} else {
if (in_array('password', $stringValidators)) {
echo $form->passwordFieldRow($this->model, $property->name, $htmlOptions, $validators);
} else {
echo $form->textFieldRow($this->model, $property->name, $htmlOptions, $validators);
}
}
}
}
echo CHtml::closeTag('div');
}