Ok, I found out how to do it. Gradually, decorators begin to understand me:
$decorators = array( 'Label', array( 'Errors', array( 'placement' => 'prepend' ) ), array( array( 'dt' => 'HtmlTag' ), array( 'tag' => 'dt' ) ), array( array( 'ddOpen' => 'HtmlTag' ), array( 'tag' => 'dd', 'openOnly' => true, 'placement' => 'append' ) ), array( 'ViewHelper' ), array( array( 'ddClose' => 'HtmlTag' ), array( 'tag' => 'dd', 'closeOnly' => true, 'placement' => 'append' ) ) );
What does it mean:
- First write
- Then add (default = add) Errors
- Wrap (default) all previous content in an HtmlTag (dt)
- Next, append (default = wrap) opening the HtmlTag (dd)
- Then add (default) ViewHelper
- Then add (default = wrap) closing the HtmlTag (dd)
Then install the decorators:
// be sure to only set them, after you have added the relevant elements to the form $this->setElementDecorators( $decorators );
PS:
Keep in mind that in my specific example invalid html is created. ;-) I found out later that <ul> elements are not allowed in <dt> elements with DOCTYPE HTML 4.01 strict
source share