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 #141 from Saeven/patch-1
Browse files Browse the repository at this point in the history
Thanks for this improvment
  • Loading branch information
neilime committed May 14, 2015
2 parents 74b5ed6 + a9428ef commit 5f4521a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,17 @@ $this->formRow(new \Zend\Form\Element('my-element', array(
)));
```

You can also set the the form-group size by passing the `twb-form-group-size` option on the element passed to formRow, example Twig syntax:

```twig
{% for f in server_form %}
{% do f.setOption( 'twb-form-group-size', 'form-group-sm' ) %}
{{ formRow( f ) }}
{% endfor %}
```



#### Static : `TwbBundle\Form\View\Helper\TwbBundleFormStatic`

Static helper can be called in a view with the view helper service `formStatic(\Zend\Form\ElementInterface $oElement)` :
Expand Down
4 changes: 4 additions & 0 deletions src/TwbBundle/Form/View/Helper/TwbBundleFormRow.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ public function render(ElementInterface $oElement, $labelPosition = null)
}

$sRowClass = '';

if( $fgs = $oElement->getOption('twb-form-group-size') ){
$sRowClass = $fgs;
}

//Validation state
if (($sValidationState = $oElement->getOption('validation-state'))) {
Expand Down

0 comments on commit 5f4521a

Please sign in to comment.