Reputation: 302
I've got the following problem: I read this doc about AnnotationForms
. It works great so far. The thing is that I now need to add a CSRF-Token
and a Submit-Button
.
The doc says that I should use a FieldSet
. But in the docs to FieldSets they only describe how to include it in a regualr Zend\Form
. But all my form definition lies within the Entity.php...because its an AnnotationForm.
Could anybody tell me how to get this token and my button into my AnnotationForm?
Upvotes: 2
Views: 1599
Reputation: 3727
While a relatively old question I was still finding it hard to find a 'correct' way to add fieldsets with the AnnotationBuilder.
See my previous stack answer on how you are able to add entities as an instance of Zend\Form\Fieldset rather than an instance of Zend\Form
Upvotes: 0
Reputation: 16455
Well, first you create the form via the AnnotationBuilder
and then you manually add your stuff.
$form = $builder->createForm('User');
$form->add(new \Zend\Form\Element\Csrf('security'));
and so on... ;)
Alternatively, since you'd want some order you'd build a Form, add the csrf
and the submit
as well as a fieldset
. Then to the add the annotation form INTO the Fieldset.
Upvotes: 4