Skip to content

Commit 40fa82f

Browse files
committed
Fix JqueryHelper::jQueryFormToRemote with Symfony 3.4
1 parent 85dbbba commit 40fa82f

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

Helper/JqueryHelper.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,15 @@ public function jQueryFormToRemote($form, $options = array(), $htmlOptions = arr
263263
$htmlOptions['onsubmit'] = $this->jQueryRemoteFunction($form->vars['action'], $options) . '; return false;';
264264

265265
//Après suppression du BC (ci-dessous), la méthode devra être uniquement ce cas
266-
return $this->templating->getRuntime('Symfony\Bridge\Twig\Form\TwigRenderer')
267-
->renderBlock($form, 'form_start', ['attr' => $htmlOptions]);
266+
try {
267+
$runtime = $this->templating->getRuntime('Symfony\Component\Form\FormRenderer');
268+
} catch (\Twig_Error_Runtime $e) {
269+
if ('Unable to load the "Symfony\Component\Form\FormRenderer" runtime.' === $e->getMessage()) { //Symfony < 3.4
270+
$runtime = $this->templating->getRuntime('Symfony\Bridge\Twig\Form\TwigRenderer');
271+
}
272+
}
273+
274+
return $runtime->renderBlock($form, 'form_start', ['attr' => $htmlOptions]);
268275
}
269276

270277
//Set Url

0 commit comments

Comments
 (0)