Skip to content

Commit a6bf0b2

Browse files
Update Select.php
add addClass method
1 parent bff4f72 commit a6bf0b2

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/Html/Options/Plugins/Select.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,23 @@ public function selectClassName($value = 'selected')
5454
return $this;
5555
}
5656

57+
/**
58+
* Append a class name to className option value.
59+
*
60+
* @param string $class
61+
* @return $this
62+
*/
63+
public function addClass($class)
64+
{
65+
if (! isset($this->attributes['className'])) {
66+
$this->attributes['className'] = $class;
67+
} else {
68+
$this->attributes['className'] .= " $class";
69+
}
70+
return $this;
71+
}
72+
73+
5774
/**
5875
* Set select info option value.
5976
*

0 commit comments

Comments
 (0)