add_clone_button

This commit is contained in:
SoHardKI 2019-07-26 12:32:43 +03:00
commit 9560efc7bc
3 changed files with 35 additions and 4 deletions

View File

@ -130,7 +130,7 @@ use yii\widgets\ActiveForm;
<div class="row">
<div class="col-xs-12">
<?= $form->field($model, 'fields')->widget(MultipleInput::class, [
'cloneButton' => true,
'columns' => [
[
'name' => 'field_id',
@ -159,8 +159,12 @@ use yii\widgets\ActiveForm;
'options' => [
'class' => 'input-priority'
]
]
]
],
],
// 'extraButtons' => function ($model, $index, $context) {
// Html::addCssClass($options, 'btn multiple-input-list__btn js-input-plus btn btn-default');
// return Html::tag('div', Html::a('', ['index'], ['class' => 'glyphicon glyphicon-plus plus-icon']), $options);
// },
])->label('Дополнительно');
?>
</div>

View File

@ -13,6 +13,7 @@ use Yii;
* @property int $item_type
* @property int $order
* @property string $value
* @property string $option
*/
class FieldsValueNew extends \yii\db\ActiveRecord
{
@ -36,7 +37,7 @@ class FieldsValueNew extends \yii\db\ActiveRecord
return [
[['field_id', 'item_id', 'item_type'], 'required'],
[['field_id', 'item_id', 'item_type', 'order'], 'integer'],
[['value'], 'string'],
[['value', 'type_file'], 'string'],
];
}
@ -52,6 +53,7 @@ class FieldsValueNew extends \yii\db\ActiveRecord
'item_type' => 'Item Type',
'order' => 'Order',
'value' => 'Value',
'type_file' => 'Приложение'
];
}

View File

@ -0,0 +1,25 @@
<?php
use yii\db\Migration;
/**
* Class m190726_064708_add_option_column
*/
class m190726_064708_add_option_column extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->addColumn('fields_value_new', 'type_file', $this->string(255)->defaultValue(null));
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
$this->dropColumn('fields_value_new', 'type_file');
}
}