Skip to content

Commit 9f79405

Browse files
committed
Add new options to BootstrapHtmlHelper to define default option for some methods.
1 parent 6b97bf1 commit 9f79405

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

src/View/Helper/BootstrapHtmlHelper.php

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,15 @@ class BootstrapHtmlHelper extends HtmlHelper {
6262
'useFontAwesome' => false,
6363
'tooltip' => [
6464
'placement' => 'right'
65+
],
66+
'label' => [
67+
'type' => 'primary'
68+
],
69+
'alert' => [
70+
'type' => 'warning'
71+
],
72+
'progress' => [
73+
'type' => 'primary'
6574
]
6675
];
6776

@@ -116,15 +125,15 @@ public function glIcon ($icon, $options = []) {
116125
* - type The type of the label (useless if $type specified)
117126
*
118127
**/
119-
public function label ($text, $type = 'default', $options = []) {
128+
public function label ($text, $type = null, $options = []) {
120129
if (is_string($type)) {
121130
$options['type'] = $type ;
122131
}
123132
else if (is_array($type)) {
124133
$options = $type ;
125134
}
126135
$options += [
127-
'type' => 'default'
136+
'type' => $this->config('label.type')
128137
];
129138
$type = $options['type'];
130139
unset ($options['type']) ;
@@ -179,15 +188,15 @@ public function getCrumbList(array $options = [], $startText = false) {
179188
* $type is specified)
180189
*
181190
**/
182-
public function alert ($text, $type = 'warning', $options = []) {
191+
public function alert ($text, $type = null, $options = []) {
183192
if (is_string($type)) {
184193
$options['type'] = $type ;
185194
}
186195
else if (is_array($type)) {
187196
$options = $type ;
188197
}
189198
$options += [
190-
'type' => 'warning'
199+
'type' => $this->config('alert.type')
191200
];
192201
$button = $this->tag('button', '×', [
193202
'type' => 'button',
@@ -268,7 +277,7 @@ public function progress ($widths, $options = []) {
268277
if (is_array($widths)) {
269278
foreach ($widths as $width) {
270279
$width += [
271-
'type' => 'primary',
280+
'type' => $this->config('progress.type'),
272281
'min' => 0,
273282
'max' => 100,
274283
'display' => false
@@ -288,7 +297,7 @@ public function progress ($widths, $options = []) {
288297
}
289298
else {
290299
$options += [
291-
'type' => 'primary',
300+
'type' => $this->config('progress.type'),
292301
'min' => 0,
293302
'max' => 100,
294303
'display' => false

0 commit comments

Comments
 (0)