* @since 2.0 */ class ActiveForm extends Widget { /** * @param array|string $action the form action URL. This parameter will be processed by [[\yii\util\Html::url()]]. */ public $action = ''; /** * @var string the form submission method. This should be either 'post' or 'get'. * Defaults to 'post'. */ public $method = 'post'; /** * @var string the default CSS class for the error summary container. * @see errorSummary() */ public $errorSummaryClass = 'yii-error-summary'; /** * @var string the default CSS class that indicates an input has error. * This is */ public $errorClass = 'yii-error'; public $successClass = 'yii-success'; public $validatingClass = 'yii-validating'; /** * @var boolean whether to enable client-side data validation. Defaults to false. * When this property is set true, client-side validation will be performed by validators * that support it (see {@link CValidator::enableClientValidation} and {@link CValidator::clientValidateAttribute}). */ public $enableClientValidation = false; public $options = array(); /** * @param Model|Model[] $models * @param array $options * @return string */ public function errorSummary($models, $options = array()) { if (!is_array($models)) { $models = array($models); } $showAll = isset($options['showAll']) && $options['showAll']); $lines = array(); /** @var $model Model */ foreach ($models as $model) { if ($showAll) { foreach ($model->getErrors() as $errors) { $lines = array_merge($lines, $errors); } } else { $lines = array_merge($lines, $model->getFirstErrors()); } } $header = isset($options['header']) ? $options['header'] : '

' . Yii::t('yii|Please fix the following errors:') . '

'; $footer = isset($options['footer']) ? $options['footer'] : ''; $container = isset($options['container']) ? $options['container'] : 'div'; unset($options['showAll'], $options['header'], $options['footer'], $options['container']); if (!isset($options['class'])) { $options['class'] = $this->errorSummaryClass; } if ($lines !== array()) { $content = "