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

Fix to allow the usage of Magento New Media Gallery (remove hardcoded… #10

Open
wants to merge 1 commit into
base: 2.x
Choose a base branch
from
Open
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
18 changes: 16 additions & 2 deletions Block/Adminhtml/ContentConstructor/Constructor.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace MageSuite\ContentConstructorAdmin\Block\Adminhtml\ContentConstructor;

use Magento\Ui\Component\Form\Element\DataType\Media\OpenDialogUrl;
use Magento\Cms\Model\Wysiwyg\Config;

class Constructor extends \Magento\Framework\View\Element\Template
{
/**
Expand Down Expand Up @@ -70,13 +73,19 @@ class Constructor extends \Magento\Framework\View\Element\Template
*/
protected $imagesHelper;

/**
* @var OpednDialogUrl
*/
protected $openDialogUrl;

/**
* Constructor constructor.
* @param \Magento\Framework\View\Element\Template\Context $context
* @param \MageSuite\ContentConstructorAdmin\Repository\Xml\XmlToComponentConfigurationMapper $xmlToComponentConfiguration
* @param \Magento\Framework\Registry $registry
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
* @param \MageSuite\ContentConstructorAdmin\Helper\Configuration $configurationHelper
* @param OpenDialogUrl $openDialogUrl
* @param array $data
*/
public function __construct(
Expand All @@ -94,6 +103,7 @@ public function __construct(
\Magento\Store\Model\StoreManagerInterface $storeManager,
\MageSuite\ContentConstructorAdmin\Helper\Configuration $configurationHelper,
\Magento\Cms\Helper\Wysiwyg\Images $imagesHelper,
OpenDialogUrl $openDialogUrl,
array $data = []
) {
parent::__construct($context, $data);
Expand All @@ -111,6 +121,7 @@ public function __construct(
$this->storeManager = $storeManager;
$this->configurationHelper = $configurationHelper;
$this->imagesHelper = $imagesHelper;
$this->openDialogUrl = $openDialogUrl;

$this->setTemplate('MageSuite_ContentConstructorAdmin::constructor.phtml');
}
Expand Down Expand Up @@ -148,8 +159,11 @@ public function getAsset($assetLocation)
public function getUploaderUrl()
{
return $this->backendUrl->getUrl(
'cms/wysiwyg_images/index',
['current_tree_path' => $this->imagesHelper->idEncode('wysiwyg')]
$this->openDialogUrl->get(), [
'current_tree_path' => $this->imagesHelper->idEncode(
Config::IMAGE_DIRECTORY // => 'wysiwyg'
)
]
);
}

Expand Down