Using Symfony Forms Without Twig

I was able to configure symfony forms to work independently in my project. However, I can make it work with a branch. Is it possible for me to make forms without a twig?

How am I doing it now:

#Controller echo $twig->render('index.html.twig', array( 'form' => $form->createView(), )); #Twig File {{ form_widget(form) }} 

Is it possible to display a form without a branch?

Any help is much appreciated

+7
php forms symfony twig symfony-forms
source share
1 answer

First you need to go to app / config and check if php is included as a template for modeling

 templating: engines: ['php', 'twig'] 

And here is one way to render a form with php:

 echo $view['form']->form($form,array('attr' => array('class' => 'Form'))); 

There are many examples for creating forms on the symfony2 official site. You can display a field by field or full form, as shown in my example.

+1
source share

All Articles