diff --git a/src/TwbsHelper/Form/View/Helper/FormElement.php b/src/TwbsHelper/Form/View/Helper/FormElement.php
index 7424d1e21..7d0a6a732 100644
--- a/src/TwbsHelper/Form/View/Helper/FormElement.php
+++ b/src/TwbsHelper/Form/View/Helper/FormElement.php
@@ -24,7 +24,10 @@
class FormElement extends ZendFormElementViewHelper implements TranslatorAwareInterface
{
// @var string
- protected static $addonFormat = '<%s class="%s" %s>%s%s>';
+ protected static $addonFormat = '<%s class="%s" %s>%s%s>';
+
+ // @var string
+ protected static $addonTextFormat = '%s';
// @var string
protected static $inputGroupFormat = '
%s
';
@@ -194,7 +197,7 @@ protected function renderAddOn($aAddOnOptions, string $sPosition = 'prepend')
$sMarkup = '';
$sAddonTagName = 'div';
- $sAddonClass = '';
+ $sAddonClass = ('prepend' == $sPosition) ? ' input-group-prepend' : 'input-group-append';
if (! empty($aAddOnOptions['text'])) {
if (! is_scalar($aAddOnOptions['text'])) {
@@ -203,12 +206,11 @@ protected function renderAddOn($aAddOnOptions, string $sPosition = 'prepend')
is_object($aAddOnOptions['text']) ? get_class($aAddOnOptions['text']) : gettype($aAddOnOptions['text'])
));
} elseif (($oTranslator = $this->getTranslator())) {
- $sMarkup .= $oTranslator->translate($aAddOnOptions['text'], $this->getTranslatorTextDomain());
+ $sMarkup .= sprintf(static::$addonTextFormat, $oTranslator->translate($aAddOnOptions['text'], $this->getTranslatorTextDomain()));
} else {
- $sMarkup .= $aAddOnOptions['text'];
+ $sMarkup .= sprintf(static::$addonTextFormat, $aAddOnOptions['text']);
}
- $sAddonClass .= ('prepend' == $sPosition) ? ' input-group-prepend' : 'input-group-append';
} elseif (! empty($aAddOnOptions['element'])) {
if (is_array($aAddOnOptions['element']) ||
($aAddOnOptions['element'] instanceof Traversable &&
@@ -229,14 +231,6 @@ protected function renderAddOn($aAddOnOptions, string $sPosition = 'prepend')
));
$sMarkup .= $this->render($aAddOnOptions['element']);
-
- //Element is a button, so add-on container must be a "div"
- if ($aAddOnOptions['element'] instanceof Button) {
- $sAddonClass .= ' input-group-btn';
- $sAddonTagName = 'div';
- } else {
- $sAddonClass .= ' input-group-addon';
- }
}
$sAttributes = '';