Skip to content

Commit

Permalink
Don't use default input class for radio and checkboxes
Browse files Browse the repository at this point in the history
  • Loading branch information
rchavik committed Sep 1, 2014
1 parent 000001d commit 104c0ba
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions Croogo/View/Helper/CroogoFormHelper.php
Expand Up @@ -148,7 +148,7 @@ protected function _divOptions($options) {
* @return array
*/
protected function _divOptionsAddon($options, $divOptions) {
if (isset($this->_addon)) {
if (isset($this->_addon) && isset($divOptions['class'])) {
$divOptions['class'] .= ' ' . $this->_addon;
unset($this->_addon);
}
Expand All @@ -165,12 +165,16 @@ protected function _parseOptions($options) {
$options = parent::_parseOptions($options);
$options = $this->_parseOptionsAddon($options);

if (
isset($options['multiple']) &&
$options['multiple'] === 'checkbox' &&
$options['class'] === $this->_View->Layout->cssClass('formInput')
) {
unset($options['class']);
if (isset($options['class'])) {
$formInput = $this->_View->Layout->cssClass('formInput');
$isMultipleCheckbox = isset($options['multiple']) &&
$options['multiple'] === 'checkbox';
$isRadioOrCheckbox = isset($options['type']) &&
in_array($options['type'], array('checkbox', 'radio'));

if ($isMultipleCheckbox || $isRadioOrCheckbox) {
$options['class'] = str_replace($formInput, '', $options['class']);
}
}

return $options;
Expand Down

0 comments on commit 104c0ba

Please sign in to comment.