Skip to content
This repository has been archived by the owner on Jul 10, 2020. It is now read-only.

Commit

Permalink
Ability to set the btn-group class
Browse files Browse the repository at this point in the history
Instead of 
`'btn-group'     => true,`
We'll use
`'btn-group'     => [
    'btn-class' => 'btn btn-success',
],`
  • Loading branch information
Alfredao committed Oct 17, 2017
1 parent a39af80 commit 1576cad
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/TwbBundle/Form/View/Helper/TwbBundleFormRadio.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,15 @@ public function render(ElementInterface $oElement)
return $sReturn;
}

if (isset($aElementOptions['btn-group']) && $aElementOptions['btn-group'] == true) {
if (isset($aElementOptions['btn-group']) && $aElementOptions['btn-group'] != false) {

$buttonClass = 'btn btn-primary';
if (is_array($aElementOptions['btn-group']) && isset($aElementOptions['btn-group']['btn-class'])) {
$buttonClass = $aElementOptions['btn-group']['btn-class'];
}

$this->setSeparator('');
$oElement->setLabelAttributes(array('class' => 'btn btn-primary'));
$oElement->setLabelAttributes(array('class' => $buttonClass));

return sprintf('<div class="btn-group" data-toggle="buttons">%s</div>', parent::render($oElement));
}
Expand Down

0 comments on commit 1576cad

Please sign in to comment.