本文整理汇总了PHP中yii\bootstrap\ActiveForm::className方法的典型用法代码示例。如果您正苦于以下问题:PHP ActiveForm::className方法的具体用法?PHP ActiveForm::className怎么用?PHP ActiveForm::className使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\bootstrap\ActiveForm
的用法示例。
在下文中一共展示了ActiveForm::className方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
<?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>
示例2: elseif
<?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]);
}
示例3: actionUpdate
/**
* 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]);
}
}