diff --git a/config/config.yaml b/config/config.yaml
index b2454e9..805ec5c 100644
--- a/config/config.yaml
+++ b/config/config.yaml
@@ -1,12 +1,10 @@
-sylius_ui:
- events:
- sylius.shop.contact.request.form:
- blocks:
- captcha:
- template: '@FluxSESyliusHCaptchaPlugin/form.html.twig'
- priority: -10
- sylius.shop.register.form:
- blocks:
- captcha:
- template: '@FluxSESyliusHCaptchaPlugin/form.html.twig'
- priority: -10
+sylius_twig_hooks:
+ hooks:
+ sylius_shop.account.register.content.form:
+ h_captcha:
+ template: '@FluxSESyliusHCaptchaPlugin/form.html.twig'
+ priority: 10
+ sylius_shop.contact.contact_request.content.form:
+ h_captcha:
+ template: '@FluxSESyliusHCaptchaPlugin/form.html.twig'
+ priority: 10
diff --git a/src/DependencyInjection/FluxSESyliusHCaptchaExtension.php b/src/DependencyInjection/FluxSESyliusHCaptchaExtension.php
index 4c00042..01bd85a 100644
--- a/src/DependencyInjection/FluxSESyliusHCaptchaExtension.php
+++ b/src/DependencyInjection/FluxSESyliusHCaptchaExtension.php
@@ -13,7 +13,7 @@ final class FluxSESyliusHCaptchaExtension extends Extension
{
public function load(array $configs, ContainerBuilder $container): void
{
- $loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
+ $loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../../config'));
$loader->load('services.yaml');
}
}
diff --git a/templates/form.html.twig b/templates/form.html.twig
index 049688d..e4f27d6 100644
--- a/templates/form.html.twig
+++ b/templates/form.html.twig
@@ -1,3 +1,5 @@
-{% form_theme form '@FluxSESyliusHCaptchaPlugin/hcaptcha.html.twig' %}
+{% form_theme hookable_metadata.context.form '@FluxSESyliusHCaptchaPlugin/hcaptcha.html.twig' %}
-{{ form_row(form.captcha) }}
+
+ {{ form_row(hookable_metadata.context.form.captcha) }}
+
diff --git a/tests/Application/Kernel.php b/tests/Application/Kernel.php
index ed657a2..d27274f 100644
--- a/tests/Application/Kernel.php
+++ b/tests/Application/Kernel.php
@@ -4,126 +4,10 @@
namespace Tests\FluxSE\SyliusHCaptchaPlugin\Application;
-use PSS\SymfonyMockerContainer\DependencyInjection\MockerContainer;
-use Sylius\Bundle\CoreBundle\Application\Kernel as SyliusKernel;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
-use Symfony\Component\Config\Loader\LoaderInterface;
-use Symfony\Component\Config\Resource\FileResource;
-use Symfony\Component\DependencyInjection\ContainerBuilder;
-use Symfony\Component\HttpKernel\Bundle\BundleInterface;
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
-use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
-/**
- * @property string $environment
- */
final class Kernel extends BaseKernel
{
use MicroKernelTrait;
-
- private const CONFIG_EXTS = '.{php,xml,yaml,yml}';
-
- public function getCacheDir(): string
- {
- return $this->getProjectDir() . '/var/cache/' . $this->environment;
- }
-
- public function getLogDir(): string
- {
- return $this->getProjectDir() . '/var/log';
- }
-
- public function registerBundles(): iterable
- {
- foreach ($this->getConfigurationDirectories() as $confDir) {
- $bundlesFile = $confDir . '/bundles.php';
- if (false === is_file($bundlesFile)) {
- continue;
- }
- yield from $this->registerBundlesFromFile($bundlesFile);
- }
- }
-
- private function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void
- {
- foreach ($this->getConfigurationDirectories() as $confDir) {
- $bundlesFile = $confDir . '/bundles.php';
- if (false === is_file($bundlesFile)) {
- continue;
- }
- $container->addResource(new FileResource($bundlesFile));
- }
-
- $container->setParameter('container.dumper.inline_class_loader', true);
-
- foreach ($this->getConfigurationDirectories() as $confDir) {
- $this->loadContainerConfiguration($loader, $confDir);
- }
- }
-
- private function configureRoutes(RoutingConfigurator $routes): void
- {
- foreach ($this->getConfigurationDirectories() as $confDir) {
- $this->loadRoutesConfiguration($routes, $confDir);
- }
- }
-
- protected function getContainerBaseClass(): string
- {
- if ($this->isTestEnvironment()) {
- return MockerContainer::class;
- }
-
- return parent::getContainerBaseClass();
- }
-
- private function isTestEnvironment(): bool
- {
- return 0 === strpos($this->getEnvironment(), 'test');
- }
-
- private function loadContainerConfiguration(LoaderInterface $loader, string $confDir): void
- {
- $loader->load($confDir . '/{packages}/*' . self::CONFIG_EXTS, 'glob');
- $loader->load($confDir . '/{packages}/' . $this->environment . '/**/*' . self::CONFIG_EXTS, 'glob');
- $loader->load($confDir . '/{services}' . self::CONFIG_EXTS, 'glob');
- $loader->load($confDir . '/{services}_' . $this->environment . self::CONFIG_EXTS, 'glob');
- }
-
- private function loadRoutesConfiguration(RoutingConfigurator $routes, string $confDir): void
- {
- $routes->import($confDir . '/{routes}/*' . self::CONFIG_EXTS);
- $routes->import($confDir . '/{routes}/' . $this->environment . '/**/*' . self::CONFIG_EXTS);
- $routes->import($confDir . '/{routes}' . self::CONFIG_EXTS);
- }
-
- /**
- * @return BundleInterface[]
- */
- private function registerBundlesFromFile(string $bundlesFile): iterable
- {
- /** @var array $contents */
- $contents = require $bundlesFile;
- foreach ($contents as $class => $envs) {
- if (isset($envs['all']) || isset($envs[$this->environment])) {
- yield new $class();
- }
- }
- }
-
- /**
- * @return string[]
- */
- private function getConfigurationDirectories(): iterable
- {
- yield $this->getProjectDir() . '/config';
- $syliusConfigDir = $this->getProjectDir() . '/config/sylius/' . SyliusKernel::MAJOR_VERSION . '.' . SyliusKernel::MINOR_VERSION;
- if (is_dir($syliusConfigDir)) {
- yield $syliusConfigDir;
- }
- $symfonyConfigDir = $this->getProjectDir() . '/config/symfony/' . BaseKernel::MAJOR_VERSION . '.' . BaseKernel::MINOR_VERSION;
- if (is_dir($symfonyConfigDir)) {
- yield $symfonyConfigDir;
- }
- }
}
diff --git a/tests/Application/config/packages/api_platform.yaml b/tests/Application/config/packages/api_platform.yaml
index cbd797a..9952e01 100644
--- a/tests/Application/config/packages/api_platform.yaml
+++ b/tests/Application/config/packages/api_platform.yaml
@@ -2,8 +2,6 @@ api_platform:
mapping:
paths:
- '%kernel.project_dir%/config/api_platform'
- - '%kernel.project_dir%/src/Entity'
- - '%kernel.project_dir%/src/ApiResource'
patch_formats:
json: ['application/merge-patch+json']
swagger:
diff --git a/tests/Application/config/sylius/.gitkeep b/tests/Application/config/sylius/.gitkeep
deleted file mode 100644
index e69de29..0000000
diff --git a/tests/Application/config/symfony/.gitkeep b/tests/Application/config/symfony/.gitkeep
deleted file mode 100644
index e69de29..0000000