diff --git a/src/TwbBundle/Form/View/Helper/TwbBundleFormRow.php b/src/TwbBundle/Form/View/Helper/TwbBundleFormRow.php index 5a93ac8..a57b5fb 100644 --- a/src/TwbBundle/Form/View/Helper/TwbBundleFormRow.php +++ b/src/TwbBundle/Form/View/Helper/TwbBundleFormRow.php @@ -217,9 +217,9 @@ protected function renderElement(ElementInterface $oElement, $sLabelPosition = n case TwbBundleForm::LAYOUT_INLINE: if ($sElementType !== 'checkbox') { if ($sElementType !== 'checkbox') { - if (empty($aLabelAttributes['class']) && empty($aLabelAttributes['showLabel']) ) { + if (empty($aLabelAttributes['class']) && empty($oElement->getOption('showLabel'))) { $aLabelAttributes['class'] = 'sr-only'; - } elseif (empty($aLabelAttributes['showLabel']) && !preg_match('/(\s|^)sr-only(\s|$)/', $aLabelAttributes['class'])) { + } elseif (empty($oElement->getOption('showLabel')) && !preg_match('/(\s|^)sr-only(\s|$)/', $aLabelAttributes['class'])) { $aLabelAttributes['class'] = trim($aLabelAttributes['class'] . ' sr-only'); } } diff --git a/tests/TwbBundleTest/BootstrapBasedTests/TwbBundleFormsTest.php b/tests/TwbBundleTest/BootstrapBasedTests/TwbBundleFormsTest.php index 8629572..9dd6cf5 100644 --- a/tests/TwbBundleTest/BootstrapBasedTests/TwbBundleFormsTest.php +++ b/tests/TwbBundleTest/BootstrapBasedTests/TwbBundleFormsTest.php @@ -90,7 +90,7 @@ public function testInlineForm() 'placeholder' => 'Enter email', 'id' => 'exampleInputEmail2' ), - 'options' => array('label' => 'Email address', 'label_attributes' => [ 'showLabel' => false ],) + 'options' => array('label' => 'Email address', 'showLabel' => false) ))->add(array( 'name' => 'input-email2', 'attributes' => array( @@ -98,7 +98,7 @@ public function testInlineForm() 'placeholder' => 'Enter email2', 'id' => 'exampleInputEmail2a' ), - 'options' => array('label' => 'Email address2', 'label_attributes' => [ 'showLabel' => true ],) + 'options' => array('label' => 'Email address2', 'showLabel' => true) ))->add(array( 'name' => 'input-password', 'attributes' => array(