}
$formView = $form->createView();
$form2 = clone $form;
$formView2 = $form2->createView();
$form3 = clone $form;
$formView3 = $form3->createView();
// ------------------------------------------------------------------
// initiate smarty & set basic stuff to get it going
$smarty = new Smarty();
$smarty->setTemplateDir(__DIR__ . '/../views/');
$smarty->setCompileDir('/tmp/test-standalone-forms-templates_c/');
// initiate our 'controller' (which is just a temp class which will hold our helper function)
$formController = new FormController();
$formController->setSymfonyVendorDir(__DIR__ . '/../vendor/symfony');
// register the form plugins with smarty, passing in the form helper which it talks to
$plugins = new SmartyFormPlugins($formController->getFormHelper());
$plugins->registerFormPluginsWithSmarty($smarty);
// give smarty some variables to play with to demonstrate everything works
$smarty->assign(['form' => $formView, 'form2' => $formView2, 'form3' => $formView3, 'isValid' => $form->isValid(), 'isSubmitted' => $form->isSubmitted()]);
// show the form as it should be.
$smarty->display('test.tpl');
echo "<hr />\n\n\n";
// alternatively, we can also generate the form using raw PHP instead too;
$formView = $form->createView();
$form_helper = $formController->getFormHelper();
echo 'Start: ' . $form_helper->start($formView) . "\n";
echo 'Fields: ' . $form_helper->rest($formView) . "\n";
echo 'End: ' . $form_helper->end($formView) . "<br />\n";
echo 'Label: ' . $form_helper->humanize('break_') . "<br />\n";
echo 'errors (array): ' . print_r($formController->getFormErrorMessagesAsStrings($form, $form_helper), true) . "<hr />\n";
echo 'errors (html): ' . $formController->getFormErrorMessagesAsHtml($form, $form_helper, $formView, ['include_container' => false, 'list_item_icon' => false]) . "<hr />\n";