Skip to content

Commit

Permalink
Check for the twig.form.resources parameter existence
Browse files Browse the repository at this point in the history
  • Loading branch information
Illya Somov committed Mar 20, 2018
1 parent ae542b3 commit 419c49e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/DependencyInjection/EWZRecaptchaExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,17 @@ protected function registerWidget(ContainerBuilder $container)
$formRessource = 'EWZRecaptchaBundle:Form:ewz_recaptcha_widget.html.twig';

$container->setParameter('twig.form.resources', array_merge(
$container->getParameter('twig.form.resources'),
$this->getTwigFormResources($container),
array($formRessource)
));
}
}

private function getTwigFormResources(ContainerBuilder $container)
{
if (!$container->hasParameter('twig.form.resources'))
return [];

return $container->getParameter('twig.form.resources');
}
}

0 comments on commit 419c49e

Please sign in to comment.