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);
} // Add toolbar items based on HTML tags and attributes.
// NOTE: Helper updates $editor->settings by reference and returns info for the message.
$result =
$this->
addToolbarItemsToMatchHtmlElementsInFormat($text_format,
$editor);
if ($result !== NULL
) { [$enabling_message_content,
$enabled_for_attributes_message_content,
$missing,
$plugins_enabled] =
$result;
// Distinguish between unsupported elements covering only tags or not.
$missing_attributes =
new HTMLRestrictions(array_filter($missing->
getAllowedElements()));