diff --git a/UPGRADE.md b/UPGRADE.md index 7f441781..228ae6ab 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -1,5 +1,8 @@ # Upgrade Notes +## 5.1.1 +- [BUGFIX] Use Pimcore AdminUserTranslator in BrickConfigBuilder [#219](https://github.com/dachcom-digital/pimcore-toolbox/issues/219) + ## 5.1.0 - [NEW FEATURE] Add `property_normalizer.default_type_mapping` feature - [ENHANCEMENT] Respect thumbnail config in normalizer diff --git a/config/core_areas/parallaxContainer_service.yaml b/config/core_areas/parallaxContainer_service.yaml index ae02a01b..f563899e 100644 --- a/config/core_areas/parallaxContainer_service.yaml +++ b/config/core_areas/parallaxContainer_service.yaml @@ -2,7 +2,7 @@ services: ToolboxBundle\Document\ToolboxAreabrick\ParallaxContainer\ParallaxContainer: parent: ToolboxBundle\Document\Areabrick\AbstractAreabrick arguments: - - '@translator' + - '@Pimcore\Bundle\AdminBundle\Translation\AdminUserTranslator' - '@pimcore.templating.engine.delegating' tags: - { name: toolbox.area.brick, id: parallaxContainer } diff --git a/config/services/editable.yaml b/config/services/editable.yaml index e88d95c8..35a3b64b 100644 --- a/config/services/editable.yaml +++ b/config/services/editable.yaml @@ -6,10 +6,14 @@ services: public: true ToolboxBundle\Builder\BrickConfigBuilderInterface: '@ToolboxBundle\Builder\BrickConfigBuilder' - ToolboxBundle\Builder\BrickConfigBuilder: ~ + ToolboxBundle\Builder\BrickConfigBuilder: + arguments: + $translator: '@Pimcore\Bundle\AdminBundle\Translation\AdminUserTranslator' ToolboxBundle\Builder\InlineConfigBuilderInterface: '@ToolboxBundle\Builder\InlineConfigBuilder' ToolboxBundle\Builder\InlineConfigBuilder: + arguments: + $translator: '@Pimcore\Bundle\AdminBundle\Translation\AdminUserTranslator' calls: - [ setHeadlessEditableRenderer, [ '@ToolboxBundle\Document\Editable\HeadlessEditableRenderer' ] ] - [ setHeadlessEditableInfoFactory, [ '@ToolboxBundle\Factory\HeadlessEditableInfoFactory' ] ] @@ -17,7 +21,10 @@ services: ToolboxBundle\Document\Editable\EditableWorker: public: true - ToolboxBundle\Document\Editable\ConfigParser: ~ + ToolboxBundle\Document\Editable\ConfigParser: + arguments: + $translator: '@Pimcore\Bundle\AdminBundle\Translation\AdminUserTranslator' + ToolboxBundle\Document\Editable\HeadlessEditableRenderer: ~ ToolboxBundle\Factory\HeadlessEditableInfoFactory: ~ diff --git a/src/Builder/AbstractConfigBuilder.php b/src/Builder/AbstractConfigBuilder.php index f581e8f8..814e0c20 100644 --- a/src/Builder/AbstractConfigBuilder.php +++ b/src/Builder/AbstractConfigBuilder.php @@ -4,7 +4,7 @@ use Pimcore\Model\Document\Editable\Area\Info; use Pimcore\Templating\Renderer\EditableRenderer; -use Pimcore\Translation\Translator; +use Symfony\Contracts\Translation\TranslatorInterface; use ToolboxBundle\Document\Editable\ConfigParser; use ToolboxBundle\Manager\AreaManagerInterface; use Twig\Environment; @@ -12,7 +12,7 @@ abstract class AbstractConfigBuilder { public function __construct( - protected Translator $translator, + protected TranslatorInterface $translator, protected Environment $templating, protected AreaManagerInterface $areaManager, protected ConfigParser $configParser, diff --git a/src/Document/Areabrick/AbstractAreabrick.php b/src/Document/Areabrick/AbstractAreabrick.php index 66b90fb7..273c01c6 100644 --- a/src/Document/Areabrick/AbstractAreabrick.php +++ b/src/Document/Areabrick/AbstractAreabrick.php @@ -7,8 +7,6 @@ use Pimcore\Model\Document; use ToolboxBundle\Builder\BrickConfigBuilderInterface; use ToolboxBundle\Document\Response\HeadlessResponse; -use ToolboxBundle\Event\HeadlessEditableActionEvent; -use ToolboxBundle\ToolboxEvents; abstract class AbstractAreabrick extends AbstractBaseAreabrick implements EditableDialogBoxInterface { diff --git a/src/Document/Editable/ConfigParser.php b/src/Document/Editable/ConfigParser.php index 4c4d95a5..9cbbf7f9 100644 --- a/src/Document/Editable/ConfigParser.php +++ b/src/Document/Editable/ConfigParser.php @@ -5,13 +5,13 @@ use Pimcore\Model\Document\Editable\Area\Info; use Pimcore\Model\Document\Editable\Checkbox; use Pimcore\Templating\Renderer\EditableRenderer; -use Pimcore\Translation\Translator; +use Symfony\Contracts\Translation\TranslatorInterface; use ToolboxBundle\Registry\StoreProviderRegistryInterface; class ConfigParser { public function __construct( - protected Translator $translator, + protected TranslatorInterface $translator, protected StoreProviderRegistryInterface $storeProvider, protected EditableRenderer $editableRenderer ) { diff --git a/src/Document/ToolboxAreabrick/ParallaxContainer/ParallaxContainer.php b/src/Document/ToolboxAreabrick/ParallaxContainer/ParallaxContainer.php index d5551c18..4bb137ce 100644 --- a/src/Document/ToolboxAreabrick/ParallaxContainer/ParallaxContainer.php +++ b/src/Document/ToolboxAreabrick/ParallaxContainer/ParallaxContainer.php @@ -5,15 +5,15 @@ use Pimcore\Model\Asset; use Pimcore\Model\Document\Editable; use Pimcore\Model\Element\ElementInterface; -use Pimcore\Translation\Translator; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Templating\EngineInterface; +use Symfony\Contracts\Translation\TranslatorInterface; use ToolboxBundle\Document\Areabrick\AbstractAreabrick; class ParallaxContainer extends AbstractAreabrick { public function __construct( - private Translator $translator, + private TranslatorInterface $translator, private EngineInterface $templating ) { } diff --git a/src/Service/DownloadInfoService.php b/src/Service/DownloadInfoService.php index ce0c97aa..47ce8610 100644 --- a/src/Service/DownloadInfoService.php +++ b/src/Service/DownloadInfoService.php @@ -3,8 +3,8 @@ namespace ToolboxBundle\Service; use Pimcore\Model\Asset; +use Symfony\Contracts\Translation\TranslatorInterface; use ToolboxBundle\Connector\BundleConnector; -use Pimcore\Translation\Translator; use ToolboxBundle\Manager\ConfigManagerInterface; class DownloadInfoService @@ -12,7 +12,7 @@ class DownloadInfoService public function __construct( protected ConfigManagerInterface $configManager, protected BundleConnector $bundleConnector, - protected Translator $translator + protected TranslatorInterface $translator ) { } @@ -44,7 +44,7 @@ public function getDownloadInfo( } $dType = pathinfo($download->getFilename(), PATHINFO_EXTENSION); - $downloadTitle = $showFileNameIfTitleEmpty ? $download->getFilename() : $this->translator->trans('Download', [], 'admin'); + $downloadTitle = $showFileNameIfTitleEmpty ? $download->getFilename() : $this->translator->trans('Download'); $dName = ($download->getMetadata('title')) ?: $downloadTitle; $dAltText = $download->getMetadata('alt') ?: ''; $dImageAltText = !empty($dAltText) ? $dAltText : $dName; diff --git a/tests/UnitDefault/Areas/AbstractAreaTest.php b/tests/UnitDefault/Areas/AbstractAreaTest.php index 44389e49..38282c89 100644 --- a/tests/UnitDefault/Areas/AbstractAreaTest.php +++ b/tests/UnitDefault/Areas/AbstractAreaTest.php @@ -11,7 +11,6 @@ use Symfony\Component\HttpFoundation\Request; use ToolboxBundle\Builder\BrickConfigBuilder; use ToolboxBundle\Manager\ConfigManager; -use ToolboxBundle\Manager\ConfigManagerInterface; abstract class AbstractAreaTest extends BundleTestCase {