本文整理匯總了PHP中CFormModel::getStringValidator方法的典型用法代碼示例。如果您正苦於以下問題:PHP CFormModel::getStringValidator方法的具體用法?PHP CFormModel::getStringValidator怎麽用?PHP CFormModel::getStringValidator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CFormModel
的用法示例。
在下文中一共展示了CFormModel::getStringValidator方法的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');
}