Skip to content

Commit

Permalink
Added gridClasses() and dataAttributes() methods to radiobutton class,
Browse files Browse the repository at this point in the history
to allow for BS3 button grouping.
  • Loading branch information
cheesegrits committed Oct 18, 2015
1 parent d2b2ee5 commit 4b14bee
Showing 1 changed file with 42 additions and 3 deletions.
45 changes: 42 additions & 3 deletions plugins/fabrik_element/radiobutton/radiobutton.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,17 +234,56 @@ public function getValue($data, $repeatCounter = 0, $opts = array())

return $v;
}

/**
* Return JS event required to trigger a 'change', this is overriding default element model.
* When in BS mode with button-grp, needs to be 'click'.
*
* @return string
*/

public function getChangeEvent()
{
return $this->buttonGroup() ? 'click' : 'change';
}


/**
* Get classes to assign to the grid
* An array of arrays of class names, keyed as 'container', 'label' or 'input',
*
* @return array
*/
protected function gridClasses()
{
if ($this->buttonGroup())
{
return array(
'label' => array('btn-default'),
'container' => array('btn-radio')
);
}
else
{
return array();
}
}

/**
* Get data attributes to assign to the container
*
* @return array
*/
protected function dataAttributes()
{
if ($this->buttonGroup())
{
return array('data-toggle="buttons"');
}
else
{
return array();
}
}


}

0 comments on commit 4b14bee

Please sign in to comment.