diff --git a/framework/yii/gii/generators/crud/Generator.php b/framework/yii/gii/generators/crud/Generator.php index ae59102..671dfbd 100644 --- a/framework/yii/gii/generators/crud/Generator.php +++ b/framework/yii/gii/generators/crud/Generator.php @@ -190,9 +190,9 @@ class Generator extends \yii\gii\Generator } $column = $tableSchema->columns[$attribute]; if ($column->phpType === 'boolean') { - return "\$form->field(\$model, '$attribute')->checkbox();"; + return "\$form->field(\$model, '$attribute')->checkbox()"; } elseif ($column->type === 'text') { - return "\$form->field(\$model, '$attribute')->textarea(['rows' => 6]);"; + return "\$form->field(\$model, '$attribute')->textarea(['rows' => 6])"; } else { if (preg_match('/^(password|pass|passwd|passcode)$/i', $column->name)) { $input = 'passwordInput'; @@ -200,9 +200,9 @@ class Generator extends \yii\gii\Generator $input = 'textInput'; } if ($column->phpType !== 'string' || $column->size === null) { - return "\$form->field(\$model, '$attribute')->$input();"; + return "\$form->field(\$model, '$attribute')->$input()"; } else { - return "\$form->field(\$model, '$attribute')->$input(['maxlength' => $column->size]);"; + return "\$form->field(\$model, '$attribute')->$input(['maxlength' => $column->size])"; } } } @@ -216,9 +216,9 @@ class Generator extends \yii\gii\Generator $tableSchema = $this->getTableSchema(); $column = $tableSchema->columns[$attribute]; if ($column->phpType === 'boolean') { - return "\$form->field(\$model, '$attribute')->checkbox();"; + return "\$form->field(\$model, '$attribute')->checkbox()"; } else { - return "\$form->field(\$model, '$attribute');"; + return "\$form->field(\$model, '$attribute')"; } } diff --git a/framework/yii/gii/generators/crud/templates/views/_form.php b/framework/yii/gii/generators/crud/templates/views/_form.php index 9f0626f..59ed780 100644 --- a/framework/yii/gii/generators/crud/templates/views/_form.php +++ b/framework/yii/gii/generators/crud/templates/views/_form.php @@ -30,15 +30,15 @@ use yii\widgets\ActiveForm;
- = ' echo Html::a('Create = StringHelper::basename($generator->modelClass) ?>', ['create'], ['class' => 'btn btn-success']); ?> + = "= " ?>Html::a('Create = StringHelper::basename($generator->modelClass) ?>', ['create'], ['class' => 'btn btn-success']) ?>
indexWidgetType === 'grid'): ?> - = " echo GridView::widget([ + = "echo GridView::widget([ 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [ @@ -48,9 +48,9 @@ $count = 0; foreach ($generator->getTableSchema()->columns as $column) { $format = $generator->generateColumnFormat($column); if (++$count < 6) { - echo "\t\t\t'" . $column->name . ($format === 'text' ? '' : ':' . $format) . "',\n"; + echo "\t\t\t'" . $column->name . ($format === 'text' ? "" : ":" . $format) . "',\n"; } else { - echo "\t\t\t// '" . $column->name . ($format === 'text' ? '' : ':' . $format) . "',\n"; + echo "\t\t\t// '" . $column->name . ($format === 'text' ? "" : ":" . $format) . "',\n"; } } ?> @@ -59,7 +59,7 @@ foreach ($generator->getTableSchema()->columns as $column) { ], ]); ?> - = " echo ListView::widget([ + = "echo ListView::widget([ 'dataProvider' => $dataProvider, 'itemOptions' => ['class' => 'item'], 'itemView' => function ($model, $key, $index, $widget) { diff --git a/framework/yii/gii/generators/crud/templates/views/update.php b/framework/yii/gii/generators/crud/templates/views/update.php index 32bab23..903a880 100644 --- a/framework/yii/gii/generators/crud/templates/views/update.php +++ b/framework/yii/gii/generators/crud/templates/views/update.php @@ -27,9 +27,9 @@ $this->params['breadcrumbs'][] = 'Update'; ?>- = ' echo Html::a('Update', ['update', = $urlParams ?>], ['class' => 'btn btn-primary']); ?> - = ' echo Html::a('Delete', ['delete', = $urlParams ?>], [ + = "= " ?>Html::a('Update', ['update', = $urlParams ?>], ['class' => 'btn btn-primary']) ?> + = "echo Html::a('Delete', ['delete', = $urlParams ?>], [ 'class' => 'btn btn-danger', 'data-confirm' => Yii::t('app', 'Are you sure to delete this item?'), 'data-method' => 'post', ]); ?>
- = ' echo DetailView::widget([ + = "echo DetailView::widget([ 'model' => $model, 'attributes' => [ getTableSchema()->columns as $column) { $format = $generator->generateColumnFormat($column); - echo "\t\t\t'" . $column->name . ($format === 'text' ? '' : ':' . $format) . "',\n"; + echo "\t\t\t'" . $column->name . ($format === 'text' ? "" : ":" . $format) . "',\n"; } ?> ],