$source_editing_additions = HTMLRestrictions::
emptySet();
// Compute the appropriate settings based on the CKEditor 4 configuration
// if it exists.
$old_editor =
$editor->
id() ? Editor::
load($editor->
id()) : NULL;
$old_editor_restrictions =
$old_editor ? HTMLRestrictions::
fromTextFormat($old_editor->
getFilterFormat()) : HTMLRestrictions::
emptySet();
// @todo Remove in https://www.drupal.org/project/drupal/issues/3245351
if ($old_editor) { $editor->
setImageUploadSettings($old_editor->
getImageUploadSettings());
} if ($old_editor &&
$old_editor->
getEditor() === 'ckeditor'
) { [$upgraded_settings,
$messages] =
$this->
createSettingsFromCKEditor4($old_editor->
getSettings(), HTMLRestrictions::
fromTextFormat($old_editor->
getFilterFormat()));
$editor->
setSettings($upgraded_settings);
// *Before* determining which elements are still needed for this text
// format, ensure that all already enabled plugins that are configurable
// have valid settings.
// For all already enabled plugins, find the ones that are configurable,
// and add their default settings. For enabled plugins with element
// subsets, compute the appropriate settings to achieve the subset that
// matches the original text format restrictions.
$this->
addDefaultSettingsForEnabledConfigurablePlugins($editor);
$this->
computeSubsetSettingForEnabledPluginsWithSubsets($editor,
$text_format);
}