-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1181 from Nazar65/ASI-support_tiny_mce_3
Enable MediaGallery to tinyMCE3
- Loading branch information
Showing
3 changed files
with
64 additions
and
1 deletion.
There are no files selected for viewing
59 changes: 59 additions & 0 deletions
59
MediaGalleryIntegration/Plugin/UpdateWysiwygDialogUrlTinyMce.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\MediaGalleryIntegration\Plugin; | ||
|
||
use Magento\Framework\UrlInterface; | ||
use Magento\Framework\DataObject; | ||
use Magento\MediaGalleryUiApi\Api\ConfigInterface; | ||
use Magento\Tinymce3\Model\Config\Gallery\Config; | ||
|
||
/** | ||
* Plugin to update open media gallery dialog URL for tinyMCE3 | ||
*/ | ||
class UpdateWysiwygDialogUrlTinyMce | ||
{ | ||
/** | ||
* @var UrlInterface | ||
*/ | ||
private $url; | ||
|
||
/** | ||
* @var ConfigInterface | ||
*/ | ||
private $config; | ||
|
||
/** | ||
* @param UrlInterface $url | ||
* @param ConfigInterface $config | ||
*/ | ||
public function __construct( | ||
UrlInterface $url, | ||
ConfigInterface $config | ||
) { | ||
$this->url = $url; | ||
$this->config = $config; | ||
} | ||
|
||
/** | ||
* Update open media gallery dialog URL for wysiwyg instance | ||
* | ||
* @param Config $subject | ||
* @param DataObject $config | ||
* @SuppressWarnings(PHPMD.UnusedFormalParameter) | ||
*/ | ||
public function afterGetConfig(Config $subject, DataObject $config): DataObject | ||
{ | ||
if (!$this->config->isEnabled()) { | ||
return $config; | ||
} | ||
|
||
$config->setData('files_browser_window_url', $this->url->getUrl('media_gallery/index/index')); | ||
|
||
return $config; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters