backendUrl = $backendUrl; $this->imagesHelper = $imagesHelper; $this->windowSize = $windowSize; $this->currentTreePath = $currentTreePath; } /** * {@inheritdoc} */ public function getConfig(\Magento\Framework\DataObject $config) : \Magento\Framework\DataObject { $pluginData = (array) $config->getData('plugins'); $imageData = [ [ 'name' => 'image', ] ]; $fileBrowserUrlParams = []; if (is_string($this->currentTreePath)) { $fileBrowserUrlParams = [ 'current_tree_path' => $this->imagesHelper->idEncode($this->currentTreePath), ]; } return $config->addData( [ 'add_images' => true, 'files_browser_window_url' => $this->backendUrl->getUrl( 'cms/wysiwyg_images/index', $fileBrowserUrlParams ), 'files_browser_window_width' => $this->windowSize['width'], 'files_browser_window_height' => $this->windowSize['height'], 'plugins' => array_merge($pluginData, $imageData) ] ); } }