Commit 3fa0a192 authored by Nigel McNie's avatar Nigel McNie
Browse files

Allow specifying a class for fieldset elements.

parent 654ebc2e
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
*/ */
function pieform_element_fieldset(Pieform $form, $element) {/*{{{*/ function pieform_element_fieldset(Pieform $form, $element) {/*{{{*/
$result = "\n<fieldset"; $result = "\n<fieldset";
if (!empty($element['collapsible'])) { if (!empty($element['collapsible']) || !empty($element['class'])) {
if (!isset($element['legend']) || $element['legend'] === '') { if (!isset($element['legend']) || $element['legend'] === '') {
Pieform::info('Collapsible fieldsets should have a legend so they can be toggled'); Pieform::info('Collapsible fieldsets should have a legend so they can be toggled');
} }
...@@ -50,6 +50,9 @@ function pieform_element_fieldset(Pieform $form, $element) {/*{{{*/ ...@@ -50,6 +50,9 @@ function pieform_element_fieldset(Pieform $form, $element) {/*{{{*/
if (!empty($element['collapsed']) && !$error) { if (!empty($element['collapsed']) && !$error) {
$classes[] = 'collapsed'; $classes[] = 'collapsed';
} }
if (!empty($element['class'])) {
$classes[] = $element['class'];
}
$result .= ' class="' . implode(' ', $classes) . '"'; $result .= ' class="' . implode(' ', $classes) . '"';
} }
$result .= ">\n"; $result .= ">\n";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment