Skip to content

Commit 46f9949

Browse files
author
Eugene Tupikov
committed
removal of depending on the widget yii2-button-widget
1 parent f9f3137 commit 46f9949

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

MultipleInput.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@
1515
use yii\db\ActiveRecord;
1616
use yii\helpers\Html;
1717
use yii\helpers\ArrayHelper;
18+
use yii\bootstrap\Button;
1819
use unclead\widgets\assets\MultipleInputAsset;
1920

2021

2122
/**
22-
* Widget for rendering multiple input for one attribute of model.
23+
* Widget for rendering multiple input for an attribute of model.
2324
*
2425
* @author Eugene Tupikov <unclead.nsk@gmail.com>
2526
*/
@@ -204,8 +205,8 @@ private function getRowTemplate()
204205
$this->template .= Button::widget(
205206
[
206207
'tagName' => 'div',
207-
'label' => false,
208-
'iconClass' => 'glyphicon glyphicon-{btn_action}',
208+
'encodeLabel' => false,
209+
'label' => Html::tag('i', null, 'glyphicon glyphicon-{btn_action}'),
209210
'type' => '{btn_type}',
210211
'options' => [
211212
'id' => $this->getElementId('button'),
@@ -229,7 +230,7 @@ private function getRowTemplate()
229230
private function renderRow($index, $data = null)
230231
{
231232
$btnAction = $index == 0 ? self::ACTION_ADD : self::ACTION_REMOVE;
232-
$btnType = $index == 0 ? Button::TYPE_DEFAULT : Button::TYPE_DANGER;
233+
$btnType = $index == 0 ? 'btn-default' : 'btn-danger';
233234

234235
$search = ['{index}', '{btn_action}', '{btn_type}'];
235236
$replace = [$index, $btnAction, $btnType];
@@ -334,7 +335,7 @@ public function registerClientScript()
334335
'id' => $this->getId(),
335336
'template' => $this->getRowTemplate(),
336337
'btn_action' => self::ACTION_REMOVE,
337-
'btn_type' => Button::TYPE_DANGER,
338+
'btn_type' => 'btn-danger',
338339
'limit' => $this->limit,
339340
'replacement' => $this->replacementKeys,
340341
]

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818
"require": {
1919
"php": ">=5.4.0",
2020
"yiisoft/yii2": "*",
21-
"yiisoft/yii2-bootstrap": "*",
22-
"unclead/yii2-button-widget": "*"
21+
"yiisoft/yii2-bootstrap": "*"
2322
},
2423
"autoload": {
2524
"psr-4": {

0 commit comments

Comments
 (0)