<?php use yii\bootstrap\ActiveForm; use common\components\keyStorage\FormWidget; /* @var $this yii\web\View */ /* @var $model common\models\KeyStorageItem */ /* @var $form yii\bootstrap\ActiveForm */ $this->title = Yii::t('backend', 'Application settings'); $this->params['breadcrumbs'][] = $this->title; ?> <div class="site-settings"> <?php echo FormWidget::widget(['model' => $model, 'formClass' => ActiveForm::className(), 'submitText' => Yii::t('backend', 'Save'), 'submitOptions' => ['class' => 'btn btn-primary']]); ?> </div>
<?php // Kartik ActiveForm if ($form::className() == 'kartik\\widgets\\ActiveForm') { echo $form->field($alias, "[{$alias->language}]url", ['addon' => ['prepend' => ['content' => $urlPrefix]]])->textInput(['maxlength' => 255, 'name' => "Alias[{$alias->language}][url]", 'data-slugified' => 'true', 'readonly' => $readonly, 'data-duplicateable' => $duplicateable]); // Bootstrap ActiveForm } elseif ($form::className() == \yii\bootstrap\ActiveForm::className()) { echo $form->field($alias, "[{$alias->language}]url", ['inputTemplate' => empty($urlPrefix) ? "{input}" : "<div class=\"input-group\"><span class=\"input-group-addon\">{$urlPrefix}</span>{input}</div>"])->textInput(['maxlength' => 255, 'name' => "Alias[{$alias->language}][url]", 'data-slugified' => 'true', 'readonly' => $readonly, 'data-duplicateable' => $duplicateable]); }
/** * Updates an existing MainCategory model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id * @return mixed */ public function actionUpdate($id) { $model = $this->findModel($id); $searchModel = new MainCategorySearch(); $dataProvider = $searchModel->search(\Yii::$app->request->queryParams); if ($model->load(Yii::$app->request->post())) { if (\Yii::$app->request->isAjax) { \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; return \yii\bootstrap\ActiveForm::className(); } $model->attributes = $_POST['MainCategory']; $model->update_at = new \yii\db\Expression('NOW()'); if ($model->save()) { $this->redirect(['index']); } } else { return $this->render('index', ['model' => $model, 'searchModel' => $searchModel, 'dataProvider' => $dataProvider]); } }