コード例 #1
0
            $firstError = false;
        }
        foreach ($model as $m) {
            foreach ($m->getErrors() as $errors) {
                foreach ($errors as $error) {
                    if ($error != '') {
                        $content .= "<li>{$error}</li>\n";
                    }
                    if ($firstError) {
                        break;
                    }
                }
            }
        }
        if ($content !== '') {
            if ($header === null) {
                $header = Yii::t('yii', 'Please fix the following input errors:');
            }
            $header = EBootstrap::tag('h4', array('class' => 'alert-heading'), $header) . "\n";
            if (!isset($htmlOptions['class'])) {
                $htmlOptions['class'] = EBootstrap::$errorSummaryCss;
            }
            EBootstrap::mergeClass($htmlOptions, array('alert', 'alert-error', 'alert-block'));
            return EBootstrap::tag('div', $htmlOptions, $header . "\n<ul>\n{$content}</ul>" . $footer);
        } else {
            return '';
        }
    }
}
EBootstrap::$afterRequiredLabel = ' <span class="required">' . Yii::t('YiiBootstrap', '(Required)') . '</span>';