diff --git a/.gitignore b/.gitignore index 5c850d6..073c844 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,5 @@ /nbproject/ nbactions.xml nb-configuration.xml -/build/ \ No newline at end of file +/build/ +.idea/ diff --git a/src/TwbBundle/Form/View/Helper/TwbBundleFormButton.php b/src/TwbBundle/Form/View/Helper/TwbBundleFormButton.php index 2cba5a5..6cfc04b 100644 --- a/src/TwbBundle/Form/View/Helper/TwbBundleFormButton.php +++ b/src/TwbBundle/Form/View/Helper/TwbBundleFormButton.php @@ -87,7 +87,12 @@ public function render(ElementInterface $oElement, $sButtonContent = null) * Define button content */ if (null === $sButtonContent) { - $sButtonContent = $oElement->getLabel(); + $sButtonContent = $oElement->getValue(); + + if (!$sButtonContent) { + $sButtonContent = $oElement->getLabel(); + } + if (null === $sButtonContent && !$aIconOptions) { throw new DomainException(sprintf( '%s expects either button content as the second argument, ' . @@ -119,16 +124,16 @@ public function render(ElementInterface $oElement, $sButtonContent = null) 'position' => self::ICON_PREPEND ); } - + if (!is_array($aIconOptions)) { throw new LogicException(sprintf( '"glyphicon" and "fontAwesome" button option expects a scalar value or an array, "%s" given', is_object($aIconOptions) ? get_class($aIconOptions) : gettype($aIconOptions) )); } - + $position = 'prepend'; - + if (!empty($aIconOptions['position'])) { $position = $aIconOptions['position']; } @@ -136,7 +141,7 @@ public function render(ElementInterface $oElement, $sButtonContent = null) if (!empty($aIconOptions['icon'])) { $icon = $aIconOptions['icon']; } - + if (!is_scalar($icon)) { throw new LogicException(sprintf( 'Glyphicon and fontAwesome "icon" option expects a scalar value, "%s" given', @@ -200,7 +205,7 @@ public function render(ElementInterface $oElement, $sButtonContent = null) $sMarkup = $this->openTag($oElement) . sprintf(self::$dropdownToggleFormat, $sButtonContent) . $this->closeTag(); - } else { + } else { /* * Add caret element */