-3

Is it possible to use Symfony to create Drupal 8 form api compliant forms?

My project needs to generate multipage forms dynamically. While I have successfully created a class which extends FormBase and implements buildForm() to create a form, I can't know in advance how many components the form will have and I obviously can't create a validate function for the components on the fly.

I just wonder if there is a way to use Symfony to create my forms.

put on hold as unclear what you're asking by Kevin, mradcliffe, Jdrupal, leymannx, Alfred Armstrong Oct 9 at 13:48

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Symfony has a Form API too, I don't know how that would be any different? – Kevin Oct 7 at 15:24
  • Validation handlers can be attached to the form elements, just using the Drupal form API. – kiamlaluno Oct 7 at 15:32
  • That is true even if you implement a form element class. – kiamlaluno Oct 7 at 15:38
  • @Kevin: Yes, I was exploring creating forms via Symfony but I saw no obvious linkage which would make the forms embeddable in and useable from Drupal 8. If I'm wrong and I have missed the obvious, I would welcome a telling off and a link to some material to study – sisko Oct 7 at 22:29
  • @kiamlaluno: Yes, I know I can attach validators to each form element but I have a database of serialised form element data. I can be asked to unserialise x, x+1 or x+10 of these form elements and add each one as a separate page in a D8 multipage form dynamically. I got that far but I need a validator function for each element - can't do that on the fly. – sisko Oct 7 at 22:38

Browse other questions tagged or ask your own question.