protected function CKEditor4To5UpgradePluginManager::validateAndBuildMaps in Drupal 10
Validates plugin definitions: avoids conflicts. Builds maps for later use.
3 calls to CKEditor4To5UpgradePluginManager::validateAndBuildMaps()
- CKEditor4To5UpgradePluginManager::computeCKEditor5PluginSubsetConfiguration in core/
modules/ ckeditor5/ src/ Plugin/ CKEditor4To5UpgradePluginManager.php - Computes elements subset configuration for CKEditor 5 plugin.
- CKEditor4To5UpgradePluginManager::mapCKEditor4SettingsToCKEditor5Configuration in core/
modules/ ckeditor5/ src/ Plugin/ CKEditor4To5UpgradePluginManager.php - Maps CKEditor 4 settings to the CKEditor 5 equivalent, if needed.
- CKEditor4To5UpgradePluginManager::mapCKEditor4ToolbarButtonToCKEditor5ToolbarItem in core/
modules/ ckeditor5/ src/ Plugin/ CKEditor4To5UpgradePluginManager.php - Maps a CKEditor 4 button to the CKEditor 5 equivalent, if it exists.
File
- core/
modules/ ckeditor5/ src/ Plugin/ CKEditor4To5UpgradePluginManager.php, line 68
Class
- CKEditor4To5UpgradePluginManager
- Provides a CKEditor 4 to 5 upgrade plugin manager.
Namespace
Drupal\ckeditor5\PluginCode
protected function validateAndBuildMaps() : void {
if ($this->cke4ButtonsMap !== NULL) {
return;
}
foreach ($this
->getDefinitions() as $upgrade_plugin_id => $definition) {
// Only one CKEditor4To5Upgrade plugin can define the upgrade path for a
// CKEditor 4 button.
if (isset($definition['cke4_buttons'])) {
assert(Inspector::assertAllStrings($definition['cke4_buttons']));
foreach ($definition['cke4_buttons'] as $cke4_button_id) {
if (isset($this->cke4ButtonsMap[$cke4_button_id])) {
throw new \OutOfBoundsException(sprintf('The "%s" CKEditor 4 button is already being upgraded by the "%s" CKEditor4To5Upgrade plugin, the "%s" plugin is as well. This conflict needs to be resolved.', $cke4_button_id, $this->cke4ButtonsMap[$cke4_button_id], $upgrade_plugin_id));
}
$this->cke4ButtonsMap[$cke4_button_id] = $upgrade_plugin_id;
}
}
// Only one CKEditor4To5Upgrade plugin can define the upgrade path for a
// CKEditor 4 plugin's settings.
if (isset($definition['cke4_plugin_settings'])) {
assert(Inspector::assertAllStrings($definition['cke4_plugin_settings']));
foreach ($definition['cke4_plugin_settings'] as $cke4_plugin_id) {
if (isset($this->cke4PluginSettingsMap[$cke4_plugin_id])) {
throw new \OutOfBoundsException(sprintf('The "%s" CKEditor 4 plugin\'s settings are already being upgraded by the "%s" CKEditor4To5Upgrade plugin, the "%s" plugin is as well. This conflict needs to be resolved.', $cke4_plugin_id, $this->cke4PluginSettingsMap[$cke4_plugin_id], $upgrade_plugin_id));
}
$this->cke4PluginSettingsMap[$cke4_plugin_id] = $upgrade_plugin_id;
}
}
// Only one CKEditor4To5Upgrade plugin can define the upgrade path for a
// CKEditor 5 plugin's elements subset configuration.
if (isset($definition['cke5_plugin_elements_subset_configuration'])) {
assert(Inspector::assertAllStrings($definition['cke5_plugin_elements_subset_configuration']));
foreach ($definition['cke5_plugin_elements_subset_configuration'] as $cke5_plugin_id) {
if (isset($this->cke5SubsetConfigurationMap[$cke5_plugin_id])) {
throw new \OutOfBoundsException(sprintf('The "%s" CKEditor 5 plugin\'s elements subset configuration is already being computed by the "%s" CKEditor4To5Upgrade plugin, the "%s" plugin is as well. This conflict needs to be resolved.', $cke5_plugin_id, $this->cke5SubsetConfigurationMap[$cke5_plugin_id], $upgrade_plugin_id));
}
$this->cke5SubsetConfigurationMap[$cke5_plugin_id] = $upgrade_plugin_id;
}
}
}
}