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

Commit

Permalink
Merge pull request #199 from Alfredao/master
Browse files Browse the repository at this point in the history
Ability to set the btn-group class
  • Loading branch information
neilime authored Oct 22, 2017
2 parents a39af80 + 1576cad commit 0a6ce92
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 0a6ce92

Please sign in to comment.