diff --git a/src/TwbBundle/Form/View/Helper/TwbBundleFormRow.php b/src/TwbBundle/Form/View/Helper/TwbBundleFormRow.php index 33c2681..e70e180 100644 --- a/src/TwbBundle/Form/View/Helper/TwbBundleFormRow.php +++ b/src/TwbBundle/Form/View/Helper/TwbBundleFormRow.php @@ -131,6 +131,11 @@ public function getRowClassFromElement(\Zend\Form\ElementInterface $oElement) ) { $sRowClass .= ' col-' . $sColumSize; } + + //Additional row class + if ($sAddRowClass = $oElement->getOption('twb-row-class')) { + $sRowClass .= ' ' . $sAddRowClass; + } return $sRowClass; } diff --git a/tests/TwbBundleTest/Form/View/Helper/TwbBundleFormRowTest.php b/tests/TwbBundleTest/Form/View/Helper/TwbBundleFormRowTest.php index fb01300..fd3760e 100644 --- a/tests/TwbBundleTest/Form/View/Helper/TwbBundleFormRowTest.php +++ b/tests/TwbBundleTest/Form/View/Helper/TwbBundleFormRowTest.php @@ -163,6 +163,19 @@ public function testRenderRadiosWithHorizontalLayout() $this->assertStringEqualsFile($this->expectedPath . 'radio-horizontal-layout.phtml', $this->formRowHelper->__invoke($oElement)); } + public function testRenderFormRowWithSpecificClass() + { + $oElement = new \Zend\Form\Element\Text('test-text', array( + 'label' => 'Test text', + 'column-size' => 'sm-10', + 'label_attributes' => array('class' => 'col-sm-2'), + 'twb-row-class' => 'my-row-class' + )); + + // Test content + $this->assertStringEqualsFile($this->expectedPath . 'row-class.phtml', $this->formRowHelper->__invoke($oElement)); + } + public function testRenderInputWithHelpTextAndError() { $oElement = new \Zend\Form\Element\Text('input-text', array( diff --git a/tests/_files/expected-rows/row-class.phtml b/tests/_files/expected-rows/row-class.phtml new file mode 100644 index 0000000..5f3ebca --- /dev/null +++ b/tests/_files/expected-rows/row-class.phtml @@ -0,0 +1 @@ +