Twig/Extension/FormExtension.php
public function showForm($id)
    {
        $form = $this->container->get('netvlies.form')->get($id);

        if ($form->getSuccess()) {
            return $this->container->get('templating')->render('NetvliesFormBundle:Twig:form_success.html.twig', array(
                'successMessage' => $form->getSuccessMessage(),
            ));
        } else {
            $formView = $form->getSf2Form()->createView();
            if ($this->container->getParameter('netvlies.form.templates.fields') != null) {
                $this->container->get('twig')->getExtension('form')->renderer->setTheme($formView, array($this->container->getParameter('netvlies.form.templates.fields')));
            }

            return $this->container->get('templating')->render($this->container->getParameter('netvlies.form.templates.form'), array(
                'id' => $form->getId(),
                'form' => $formView,
            ));
        }
    }
public function showForm($id)
    {
        $form = $this->container->get('netvlies.form')->get($id);

        if ($form->getSuccess()) {
            return $this->container->get('templating')->render('NetvliesFormBundle:Twig:form_success.html.twig', array(
                'successMessage' => $form->getSuccessMessage(),
            ));
        } else {
            $formView = $form->getSf2Form()->createView();
            if ($this->container->getParameter('netvlies.form.templates.fields') != null) {
                $this->container->get('twig')->getExtension('form')->renderer->setTheme($formView, array($this->container->getParameter('netvlies.form.templates.fields')));
            }

            return $this->container->get('templating')->render($this->container->getParameter('netvlies.form.templates.form'), array(
                'id' => $form->getId(),
                'form' => $formView,
            ));
        }
    }
public function showForm ( $ id ) { $ form = $ this -> container -> get ( 'netvlies.form' ) -> get ( $ id ) ; if ( $ form -> getSuccess ( ) ) { return $ this -> container -> get ( 'templating' ) -> render ( 'NetvliesFormBundle:Twig:form_success.html.twig' , array ( 'successMessage' => $ form -> getSuccessMessage ( ) , ) ) ; } else { $ formView = $ form -> getSf2Form ( ) -> createView ( ) ; if ( $ this -> container -> getParameter ( 'netvlies.form.templates.fields' ) != null ) { $ this -> container -> get ( 'twig' ) -> getExtension ( 'form' ) -> renderer -> setTheme ( $ formView , array ( $ this -> container -> getParameter ( 'netvlies.form.templates.fields' ) ) ) ; } return $ this -> container -> get ( 'templating' ) -> render ( $ this -> container -> getParameter ( 'netvlies.form.templates.form' ) , array ( 'id' => $ form -> getId ( ) , 'form' => $ formView , ) ) ; } }
Twig function that displays the form with the requested ID.
If the form post was successful, the success message is shown
by the Twig renderer.

@param $id

@return mixed
Twig function that displays the form with the requested ID . If the form post was successful the success message is shown by the Twig renderer .