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 #56 from alejandro-fiore/master
Browse files Browse the repository at this point in the history
Fix wrong class assigned to button of type "reset"
  • Loading branch information
neilime committed Feb 23, 2014
2 parents 9b9a4f1 + 4f5e2ac commit eabfd43
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/TwbBundle/Form/View/Helper/TwbBundleFormElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function render(\Zend\Form\ElementInterface $oElement)
//Add form-controll class
$sElementType = $oElement->getAttribute('type');

if (!in_array($sElementType, array('file', 'checkbox', 'radio', 'submit', 'multi_checkbox', 'static', 'button'))) {
if (!in_array($sElementType, array('file', 'checkbox', 'radio', 'submit', 'multi_checkbox', 'static', 'button', 'reset'))) {
if ($sElementClass = $oElement->getAttribute('class')) {
if (!preg_match('/(\s|^)form-control(\s|$)/', $sElementClass)) $oElement->setAttribute('class', trim($sElementClass . ' form-control'));
} else $oElement->setAttribute('class', 'form-control');
Expand Down Expand Up @@ -204,4 +204,4 @@ public function getTranslatorTextDomain()
{
return $this->translatorTextDomain;
}
}
}
4 changes: 3 additions & 1 deletion src/TwbBundle/Form/View/Helper/TwbBundleFormRow.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ public function render(\Zend\Form\ElementInterface $oElement)
if (in_array($sElementType, array('checkbox')) && $sLayout !== \TwbBundle\Form\View\Helper\TwbBundleForm::LAYOUT_HORIZONTAL) {
return $sElementContent . PHP_EOL;
}
if ($sElementType === 'submit' && $sLayout === \TwbBundle\Form\View\Helper\TwbBundleForm::LAYOUT_INLINE) {
if (($sElementType === 'submit' || $sElementType === 'button' || $sElementType === 'reset')
&& $sLayout === \TwbBundle\Form\View\Helper\TwbBundleForm::LAYOUT_INLINE
) {
return $sElementContent . PHP_EOL;
}

Expand Down

0 comments on commit eabfd43

Please sign in to comment.