本文整理汇总了PHP中yii\widgets\ActiveForm::init方法的典型用法代码示例。如果您正苦于以下问题:PHP ActiveForm::init方法的具体用法?PHP ActiveForm::init怎么用?PHP ActiveForm::init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\widgets\ActiveForm
的用法示例。
在下文中一共展示了ActiveForm::init方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
$this->id = $this->model->formName();
$this->action = RequestModule::getPopupUrl(['type' => $this->model->tableName()]);
$this->fieldConfig = ['template' => '<div class="row">{input}{error}</div>', 'errorOptions' => ['class' => 'errorMessage']];
parent::init();
}
示例2: init
/**
* @inheritdoc
*/
public function init()
{
if (!in_array($this->layout, ['default', 'horizontal', 'stacked'])) {
throw new InvalidConfigException('Invalid layout type: ' . $this->layout);
}
Html::addCssClass($this->options, 'uk-form');
if ($this->layout !== 'default') {
Html::addCssClass($this->options, 'uk-form-' . $this->layout);
}
if ($this->field_size) {
if (!in_array($this->field_size, ['large', 'small'])) {
throw new InvalidConfigException('Invalid size: ' . $this->layout . '. It must be large or small');
}
Html::addCssClass($this->inputOptions, 'uk-form-' . $this->field_size);
}
if ($this->field_size) {
if (!in_array($this->field_size, ['large', 'small'])) {
throw new InvalidConfigException('Invalid size: ' . $this->layout . '. It must be large & small');
} else {
Html::addCssClass($this->inputOptions, 'uk-form-' . $this->field_size);
}
}
if ($this->field_width) {
if (!in_array($this->field_width, ['full', 'large', 'medium', 'small', 'mini'])) {
throw new InvalidConfigException('Invalid width: ' . $this->field_width . '. It must be full, large, medium, small or mini');
} else {
Html::addCssClass($this->inputOptions, $this->field_width != 'full' ? 'uk-form-width-' . $this->field_width : 'uk-width-1-1');
}
}
if (isset($this->inputOptions['class'])) {
$this->fieldConfig['inputOptions'] = ['class' => $this->inputOptions['class']];
}
parent::init();
}
示例3: init
public function init()
{
if ($this->full) {
echo $this->prepend;
}
parent::init();
}
示例4: init
public function init()
{
if (!isset($this->fieldConfig['class'])) {
$this->fieldConfig['class'] = ActiveField::className();
}
parent::init();
}
示例5: init
public function init()
{
if (!isset($this->fieldConfig['class'])) {
$this->fieldConfig['class'] = ActiveField::className();
}
Html::addCssClass($this->options, static::$_configuration[$this->type]['class']);
parent::init();
}
示例6: init
public function init()
{
ActiveFormAsset::register($this->getView());
parent::init();
echo '<div class="panel panel-default panel-form">';
if ($this->title) {
echo '<div class="panel-heading">' . $this->title . '</div>';
}
echo '<div class="panel-body">';
}
示例7: init
/**
* @inheritdoc
*/
public function init()
{
if (!in_array($this->layout, ['default', 'inline'])) {
throw new InvalidConfigException('Invalid layout type: ' . $this->layout);
}
if ($this->layout !== 'default') {
Html::addCssClass($this->options, 'form-' . $this->layout);
}
parent::init();
}
示例8: init
/**
* Renders the widget.
*/
public function init()
{
$this->getView()->registerJs(file_get_contents(Yii::getAlias('@vendor/anli/yii2-helper/js/modal-active-form.js')));
$this->getView()->registerJs(file_get_contents(Yii::getAlias('@vendor/anli/yii2-helper/js/modal-hint.js')));
$this->getView()->registerCss(file_get_contents(Yii::getAlias('@vendor/anli/yii2-helper/css/hint.css')));
$this->getView()->registerCss(file_get_contents(Yii::getAlias('@vendor/anli/yii2-helper/css/select2.css')));
$this->options = ['class' => 'modal-form', 'data-modal-id' => $this->modalId, 'data-select-id' => $this->selectId];
$this->enableClientValidation = true;
parent::init();
}
示例9: init
/**
* @inheritdoc
*/
public function init()
{
parent::init();
$id = $this->options['id'];
$clientSideKey = Yii::$app->get('braintree')->clientSideKey;
$view = $this->getView();
BraintreeAsset::register($view);
$view->registerJs("braintree.setup('{$clientSideKey}', 'custom', {id: '{$id}'});");
$this->fieldClass = ActiveField::className();
}
示例10: init
public function init()
{
if ($this->size) {
Html::addCssClass($this->options, $this->size);
}
if ($this->inverted === true) {
Html::addCssClass($this->options, 'inverted');
}
parent::init();
}
示例11: init
public function init()
{
if (!in_array($this->size, $this->getSizes(), true)) {
throw new InvalidConfigException('Invalid size: ' . $this->size);
}
if ($this->size !== self::SIZE_NORMAL) {
Html::addCssClass($this->options, $this->size);
}
if ($this->inverted === true) {
Html::addCssClass($this->options, 'inverted');
}
parent::init();
}
示例12: init
/**
* @inheritDoc
*/
public function init()
{
if (!in_array($this->layout, ['standard', 'horizontal', 'inline'])) {
throw new InvalidConfigException('Invalid layout type: ' . $this->layout);
}
if ($this->layout !== 'standard') {
Html::addCssClass($this->options, 'form-' . $this->layout);
}
if (!isset($this->fieldConfig['class'])) {
$this->fieldConfig['class'] = ActiveField::className();
}
return parent::init();
}
示例13: init
public function init()
{
if ($this->size) {
UI::addCssClasses($this->options, $this->size);
}
if ($this->inverted === true) {
UI::addCssClasses($this->options, 'inverted');
}
if ($this->equalWidth === true) {
UI::addCssClasses($this->options, 'equal width');
}
parent::init();
}
示例14: init
/**
* (non-PHPdoc)
* @see \yii\widgets\ActiveForm::init()
*/
public function init()
{
Pjax::begin(['id' => 'flexform-widget-whole']);
Pjax::begin(['id' => 'flexform-widget']);
parent::init();
if (!isset($this->formModel)) {
throw new InvalidConfigException("The \$formModel must be setup.");
}
$this->_module = Config::initModule(Module::classname());
$this->modelClass = (new \ReflectionClass($this->formModel->className()))->getShortName();
$this->template_name = $this->modelClass;
$this->initTemplate(false);
$this->prepareModel();
}
示例15: init
/**
* Initializes the widget.
* This renders the form open tag.
*/
public function init()
{
if (isset($this->options['class']) and strpos($this->options['class'], 'form-horizontal') !== FALSE) {
$this->isHorizontal = true;
$this->fieldConfig = function ($model, $atttribute, $options) {
if (isset($options['inputColumnClass'])) {
$inputColumnClass = $options['inputColumnClass'];
} else {
$inputColumnClass = 'col-sm-10';
}
return ['template' => "{label}\n<div class=\"" . $inputColumnClass . "\">{input}</div>\n<div class=\"col-md-offset-2 col-md-10\">{error}</div>"];
};
}
M22FormAsset::register(Yii::$app->view);
parent::init();
}