Skip to content

Commit

Permalink
Merge pull request #196 from someniatko/master
Browse files Browse the repository at this point in the history
Check for the twig.form.resources parameter existence
  • Loading branch information
excelwebzone committed Mar 20, 2018
2 parents ae542b3 + 419c49e commit 3219e7a
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 3219e7a

Please sign in to comment.