Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Pimcore AdminUserTranslator for Editable Dialog Box #222

Merged
merged 1 commit into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion config/core_areas/parallaxContainer_service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
11 changes: 9 additions & 2 deletions config/services/editable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,25 @@ 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' ] ]

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: ~
Expand Down
4 changes: 2 additions & 2 deletions src/Builder/AbstractConfigBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

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;

abstract class AbstractConfigBuilder
{
public function __construct(
protected Translator $translator,
protected TranslatorInterface $translator,
protected Environment $templating,
protected AreaManagerInterface $areaManager,
protected ConfigParser $configParser,
Expand Down
2 changes: 0 additions & 2 deletions src/Document/Areabrick/AbstractAreabrick.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
4 changes: 2 additions & 2 deletions src/Document/Editable/ConfigParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
) {
}
Expand Down
6 changes: 3 additions & 3 deletions src/Service/DownloadInfoService.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
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
{
public function __construct(
protected ConfigManagerInterface $configManager,
protected BundleConnector $bundleConnector,
protected Translator $translator
protected TranslatorInterface $translator
) {
}

Expand Down Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion tests/UnitDefault/Areas/AbstractAreaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Loading