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(); }
/** * @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(); }
public function init() { if ($this->full) { echo $this->prepend; } parent::init(); }
public function init() { if (!isset($this->fieldConfig['class'])) { $this->fieldConfig['class'] = ActiveField::className(); } parent::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(); }
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">'; }
/** * @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(); }
/** * 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(); }
/** * @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(); }
public function init() { if ($this->size) { Html::addCssClass($this->options, $this->size); } if ($this->inverted === true) { Html::addCssClass($this->options, 'inverted'); } parent::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(); }
/** * @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(); }
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(); }
/** * (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(); }
/** * 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(); }
/** * @inheritdoc */ public function init() { if ($this->model instanceof \cookyii\base\FormModel) { $this->name = empty($this->name) ? $this->model->getClass() : $this->name; $this->action = empty($this->action) ? $this->model->formAction() : $this->action; } if (!isset($this->options['id'])) { $this->options['id'] = $this->name; } if (!isset($this->options['ng-submit'])) { $this->options['ng-submit'] = sprintf('submit(%s, $event)', $this->name); } if (!empty($this->controller)) { $this->options['ng-controller'] = $this->controller; } if (!isset($this->options['name'])) { $this->options['name'] = $this->name; } if (!isset($this->options['novalidate'])) { $this->options['novalidate'] = true; } parent::init(); }
/** * @inheritdoc * @throws InvalidConfigException */ public function init() { if (!is_int($this->fullSpan) || $this->fullSpan < 1) { throw new InvalidConfigException("The 'fullSpan' property must be a valid positive integer."); } $this->initForm(); parent::init(); $this->registerAssets(); }
/** * Initializes the widget. * * @throws \yii\base\InvalidConfigException */ public function init() { if (!is_int($this->fullSpan) && $this->fullSpan < 1) { throw new InvalidConfigException("The 'fullSpan' property must be a valid positive integer."); } $this->registerAssets(); $this->initForm(); $config = $this->formConfig; $span = $config['labelSpan']; $size = $config['deviceSize']; $formStyle = $this->getFormLayoutStyle(); $this->_labelCss = $formStyle['labelCss']; $this->_inputCss = $formStyle['inputCss']; $this->_offsetCss = $formStyle['offsetCss']; if ($span != self::NOT_SET && intval($span) > 0) { $span = intval($span); /* Validate if invalid labelSpan is passed - else set to DEFAULT_LABEL_SPAN */ if ($span <= 0 && $span >= $this->fullSpan) { $span = self::DEFAULT_LABEL_SPAN; } /* Validate if invalid deviceSize is passed - else default to medium */ if ($size == self::NOT_SET) { $size = self::SIZE_MEDIUM; } $prefix = "col-{$size}-"; $this->_labelCss = $prefix . $span; $this->_inputCss = $prefix . ($this->fullSpan - $span); $this->_offsetCss = "col-" . $size . "-offset-" . $span . " " . $this->_inputCss; } if ($this->_inputCss == self::NOT_SET && empty($this->fieldConfig['template'])) { $this->fieldConfig['template'] = "{label}\n{input}\n{hint}\n{error}"; } parent::init(); }
/** * @see Init extension default */ public function init() { parent::init(); //Set default response behavior if (!isset($this->stripeResponseHandler)) { $this->stripeResponseHandler = 'function stripeResponseHandler(status, response) { var $form = $("#' . $this->options['id'] . '"); if (response.error) { $form.find("#' . $this->errorContainerId . '").text(response.error.message); $form.find("button").prop("disabled", false); } else { var token = response.id; $form.append($("<input type=\\"hidden\\" name=\\"' . $this->tokenInputName . '\\" id=\\"' . $this->tokenInputName . '\\" />").val(token)); $form.get(0).submit(); } };'; } }
/** * @inheritdoc */ public function init() { if (!in_array($this->layout, ['default', 'horizontal', 'inline'])) { throw new InvalidConfigException('Invalid layout type: ' . $this->layout); } if ($this->layout !== 'default') { Html::addCssClass($this->options, 'form-' . $this->layout); } // BootstrapAsset::register($this->view); parent::init(); }
/** * @see \yii\widgets\ActiveForm::init() */ public function init() { parent::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->layout == 'horizontal') { $this->fieldConfig['template'] = "{label}\n<div class=\"uk-form-controls\">{input}\n{error}\n{hint}\n</div>\n"; } else { $this->fieldConfig['template'] = "{label}\n<div class=\"uk-form-controls\">{input}\n{error}\n{hint}\n</div>\n"; } } if (!isset($this->fieldConfig['labelOptions'])) { $this->fieldConfig['labelOptions'] = ['class' => 'uk-form-label']; } if (!isset($this->fieldConfig['options'])) { $this->fieldConfig['options'] = ['class' => 'uk-form-row']; } if (!isset($this->fieldConfig['errorOptions'])) { $this->fieldConfig['errorOptions'] = ['class' => 'uk-form-help-block']; } if (!isset($this->fieldConfig['inputOptions'])) { $this->fieldConfig['inputOptions'] = ['class' => 'uk-form-large uk-width-1-1']; } parent::init(); }
/** * @inheritdoc */ public function init() { Html::addCssClass($this->options, 'smart-form'); parent::init(); }