Skip to content

Commit 0ae10f0

Browse files
committed
use di configuration instead of plugin
1 parent c2c8f82 commit 0ae10f0

File tree

3 files changed

+22
-54
lines changed

3 files changed

+22
-54
lines changed

app/code/Magento/PageBuilder/Model/Config/ContentType/AdditionalData/Provider/Uploader/OpenDialogUrl.php

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,33 @@
99
namespace Magento\PageBuilder\Model\Config\ContentType\AdditionalData\Provider\Uploader;
1010

1111
use Magento\PageBuilder\Model\Config\ContentType\AdditionalData\ProviderInterface;
12-
use Magento\Framework\FlagManager;
12+
use Magento\Backend\Model\Url;
1313

1414
/**
1515
* Provides open dialog URL for media gallery slideout
1616
*/
1717
class OpenDialogUrl implements ProviderInterface
1818
{
19-
private const MEDIA_GALLERY_OPEN_URL = 'open_dialog_url';
20-
2119
/**
22-
* @var FlagManager
20+
* @var Url
2321
*/
24-
private $flagManager;
22+
private $urlBuilder;
2523

2624
/**
27-
* @param FlagManager $flagManager
25+
* @var string
2826
*/
29-
public function __construct(FlagManager $flagManager)
30-
{
31-
$this->flagManager = $flagManager;
27+
private $openDialogPath;
28+
29+
/**
30+
* @param Url $urlBuilder
31+
* @param string $openDialogPath
32+
*/
33+
public function __construct(
34+
Url $urlBuilder,
35+
string $openDialogPath
36+
) {
37+
$this->urlBuilder = $urlBuilder;
38+
$this->openDialogPath = $openDialogPath;
3239
}
3340

3441
/**
@@ -37,7 +44,7 @@ public function __construct(FlagManager $flagManager)
3744
public function getData(string $itemName) : array
3845
{
3946
return [
40-
$itemName => $this->flagManager->getFlagData(self::MEDIA_GALLERY_OPEN_URL)
47+
$itemName => $this->urlBuilder->getUrl($this->openDialogPath, ['_secure' => true])
4148
];
4249
}
4350
}

app/code/Magento/PageBuilder/Plugin/SetOpenDialogUrl.php

Lines changed: 0 additions & 44 deletions
This file was deleted.

app/code/Magento/PageBuilder/etc/adminhtml/di.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
<type name="Magento\Catalog\Block\Product\ImageFactory">
1313
<plugin name="designLoader" type="Magento\PageBuilder\Plugin\DesignLoader" />
1414
</type>
15+
<type name="Magento\PageBuilder\Model\Config\ContentType\AdditionalData\Provider\Uploader\OpenDialogUrl">
16+
<arguments>
17+
<argument name="openDialogPath" xsi:type="string">cms/wysiwyg_images/index</argument>
18+
</arguments>
19+
</type>
1520
<type name="Magento\Ui\Component\Form\Element\DataType\Media\Image">
1621
<plugin name="setOpenDialogUrl" type="Magento\PageBuilder\Plugin\SetOpenDialogUrl"/>
1722
</type>

0 commit comments

Comments
 (0)