From 2bcee622ce13b8a420f6dc223615b3dc39daa05a Mon Sep 17 00:00:00 2001 From: Dominik Pfaffenbauer Date: Mon, 28 Oct 2024 08:23:09 +0100 Subject: [PATCH] [Frontend] introduce template installer and new best-practice --- .../FrontendBundle/CoreShopFrontendBundle.php | 2 ++ .../CompilerPass/FrontendInstallerPass.php | 35 +++++++++++++++++++ .../Installer/FrontendInstaller.php | 7 ++-- .../config/services/frontend-installer.yaml | 9 ++++- 4 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 src/CoreShop/Bundle/FrontendBundle/DependencyInjection/CompilerPass/FrontendInstallerPass.php diff --git a/src/CoreShop/Bundle/FrontendBundle/CoreShopFrontendBundle.php b/src/CoreShop/Bundle/FrontendBundle/CoreShopFrontendBundle.php index 158239b0cc..22e188bb6d 100644 --- a/src/CoreShop/Bundle/FrontendBundle/CoreShopFrontendBundle.php +++ b/src/CoreShop/Bundle/FrontendBundle/CoreShopFrontendBundle.php @@ -20,6 +20,7 @@ use Composer\InstalledVersions; use CoreShop\Bundle\CoreBundle\CoreShopCoreBundle; +use CoreShop\Bundle\FrontendBundle\DependencyInjection\CompilerPass\FrontendInstallerPass; use CoreShop\Bundle\FrontendBundle\DependencyInjection\CompilerPass\RegisterFrontendControllerPass; use Pimcore\Extension\Bundle\AbstractPimcoreBundle; use Pimcore\HttpKernel\Bundle\DependentBundleInterface; @@ -38,6 +39,7 @@ public function build(ContainerBuilder $container): void parent::build($container); $container->addCompilerPass(new RegisterFrontendControllerPass()); + $container->addCompilerPass(new FrontendInstallerPass()); } public function getNiceName(): string diff --git a/src/CoreShop/Bundle/FrontendBundle/DependencyInjection/CompilerPass/FrontendInstallerPass.php b/src/CoreShop/Bundle/FrontendBundle/DependencyInjection/CompilerPass/FrontendInstallerPass.php new file mode 100644 index 0000000000..8718441395 --- /dev/null +++ b/src/CoreShop/Bundle/FrontendBundle/DependencyInjection/CompilerPass/FrontendInstallerPass.php @@ -0,0 +1,35 @@ +installers as $installer) { + /** @var FrontendInstallerInterface $installer */ + foreach ($this->installers->all() as $installer) { $installer->installFrontend($frontendBundlePath, $rootPath, $templatePath); } } diff --git a/src/CoreShop/Bundle/FrontendBundle/Resources/config/services/frontend-installer.yaml b/src/CoreShop/Bundle/FrontendBundle/Resources/config/services/frontend-installer.yaml index 69bdcefff3..9c6e1c1923 100644 --- a/src/CoreShop/Bundle/FrontendBundle/Resources/config/services/frontend-installer.yaml +++ b/src/CoreShop/Bundle/FrontendBundle/Resources/config/services/frontend-installer.yaml @@ -1,4 +1,11 @@ services: + coreshop.registry.frontend.installers: + class: CoreShop\Component\Registry\ServiceRegistry + arguments: + - CoreShop\Bundle\FrontendBundle\Installer\FrontendInstallerInterface + - frontend-installers + tags: + - { name: coreshop.registry, type_hint: frontendInstallers } CoreShop\Bundle\FrontendBundle\Installer\TemplatesInstaller: tags: @@ -11,4 +18,4 @@ services: CoreShop\Bundle\FrontendBundle\Installer\FrontendInstallerInterface: '@CoreShop\Bundle\FrontendBundle\Installer\FrontendInstaller' CoreShop\Bundle\FrontendBundle\Installer\FrontendInstaller: arguments: - - !tagged_iterator coreshop.frontend.installer \ No newline at end of file + - '@coreshop.registry.cart_item_price_rule.actions' \ No newline at end of file