18 private $activeEditor;
25 private $variablePluginConfigProvider;
32 private $widgetPluginConfigProvider;
39 private $wysiwygConfigPostProcessor;
46 private $configProviderFactory;
53 private $activeEditorPath;
60 private $galleryConfigProvider;
73 array $variablePluginConfigProvider,
74 array $widgetPluginConfigProvider,
75 array $galleryConfigProvider,
76 array $wysiwygConfigPostProcessor
78 $this->activeEditor = $activeEditor;
79 $this->configProviderFactory = $configProviderFactory;
80 $this->variablePluginConfigProvider = $variablePluginConfigProvider;
81 $this->widgetPluginConfigProvider = $widgetPluginConfigProvider;
82 $this->galleryConfigProvider = $galleryConfigProvider;
83 $this->wysiwygConfigPostProcessor = $wysiwygConfigPostProcessor;
94 return $this->updateConfig(
$config, $this->variablePluginConfigProvider);
105 return $this->updateConfig(
$config, $this->widgetPluginConfigProvider);
116 return $this->updateConfig(
$config, $this->galleryConfigProvider);
127 return $this->updateConfig(
$config, $this->wysiwygConfigPostProcessor);
136 private function getActiveEditorPath(
$config)
138 if (!isset($this->activeEditorPath) || $this->activeEditorPath !==
$config->getData(
'activeEditorPath')) {
139 $this->activeEditorPath =
$config->getData(
'activeEditorPath')
140 ?
$config->getData(
'activeEditorPath')
141 : $this->activeEditor->getWysiwygAdapterPath();
142 $config->setData(
'activeEditorPath', $this->activeEditorPath);
144 return $this->activeEditorPath;
154 private function updateConfig(
$config, array $configProviders)
156 $adapterType = $this->getActiveEditorPath(
$config);
158 $providerClass = isset($configProviders[$adapterType])
159 ? $configProviders[$adapterType]
160 : $configProviders[
'default'];
162 $provider = $this->configProviderFactory->create($providerClass);
163 return $provider->getConfig(
$config);
__construct(\Magento\Ui\Block\Wysiwyg\ActiveEditor $activeEditor, \Magento\Cms\Model\Wysiwyg\ConfigProviderFactory $configProviderFactory, array $variablePluginConfigProvider, array $widgetPluginConfigProvider, array $galleryConfigProvider, array $wysiwygConfigPostProcessor)
processWidgetConfig($config)
processWysiwygConfig($config)
processGalleryConfig($config)
processVariableConfig($config)