Skip to content

Commit db7c7cc

Browse files
authored
Merge pull request #2 from lucianolima00/html-props-group
Add HTML options to btn-group div
2 parents 60ff9af + ab58ea3 commit db7c7cc

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#CHANGELOG(Registro de alterações)
22

3+
###[0.0.4] - Add HTML options to btn-group div ([@lucianolima00](https://gitlab.com/lucianolima00))
4+
35
###[0.0.3] - Fix wrong key for ArrayHelper to subordinate class ([@lucianolima00](https://gitlab.com/lucianolima00))
46

57
###[0.0.2] - Support to PHP 7.0 and above ([@thtmorais](https://gitlab.com/thtmorais))

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ Once the extension is installed, simply use it in your code by :
5252
'href' => 'http://www.yiiframework.com/extensions/',
5353
'text' => 'Yii Extensions'
5454
]
55+
],
56+
'options' => [
57+
'id' => 'group-dropdown',
58+
'class' => 'p-1'
5559
]
5660
]) ?>
5761
```

src/Dropdown.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ class Dropdown extends Widget
2525
*/
2626
public $subordinate = [];
2727

28+
/**
29+
* @var array
30+
*/
31+
public $options = [];
32+
2833
/**
2934
* {@inheritDoc}
3035
*/

src/views/dropdown.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,16 @@
66
/* @var $dropdown \thtmorais\dropdown\Dropdown */
77

88
$dropdown = $this->context;
9+
$dropdownOptionsId = ArrayHelper::getValue($dropdown->options,"id", "dropdown-group");
10+
$dropdownOptionsClass = ArrayHelper::getValue($dropdown->options,"class");
911

1012
$dropdownMainId = ArrayHelper::getValue($dropdown->main,"id","main");
1113
$dropdownMainHref = ArrayHelper::getValue($dropdown->main,"href","#");
1214
$dropdownMainClass = ArrayHelper::getValue($dropdown->main,"class","btn btn-success");
1315
$dropdownMainText = ArrayHelper::getValue($dropdown->main,"text","main");
1416
?>
1517

16-
<div class="btn-group">
18+
<div id="<?= $dropdownOptionsId ?>" class="<?= $dropdownOptionsClass ? ("btn-group " . $dropdownOptionsClass) : "btn-group" ?>">
1719
<a id="<?= $dropdownMainId ?>" href="<?= $dropdownMainHref ?>" class="<?= $dropdownMainClass ?>"><?= $dropdownMainText ?></a>
1820
<button class="<?= $dropdown->dropdownToggleClass ?> dropdown-toggle" data-toggle="dropdown">
1921
<span class="caret"></span>

0 commit comments

Comments
 (0)