$language =
$this->languageManager->
getCurrentLanguage();
// When enabling CKEditor 5, generate sensible settings from the
// pre-existing text editor/format rather than the hardcoded defaults
// whenever possible.
// @todo Remove after https://www.drupal.org/project/drupal/issues/3226673.
$format =
$form_state->
getFormObject()->
getEntity();
assert($format instanceof FilterFormatInterface
);
if ($editor->
isNew() && !
$form_state->
get('ckeditor5_is_active'
) &&
$form_state->
get('ckeditor5_is_selected'
)) { assert($editor->
getSettings() ===
$this->
getDefaultSettings());
if (!
$format->
isNew()) { [$editor,
$messages] =
$this->smartDefaultSettings->
computeSmartDefaultSettings($editor,
$format);
$form_state->
set('used_smart_default_settings', TRUE
);
foreach ($messages as $type =>
$messages_per_type) { foreach ($messages_per_type as $message) { $this->
messenger()->
addMessage($message,
$type);
} } if (isset($messages[MessengerInterface::TYPE_WARNING
]) ||
isset($messages[MessengerInterface::TYPE_ERROR
])) { $this->
messenger()->
addMessage($this->
t('Check <a href=":handbook">this handbook page</a> for details about compatibility issues of contrib modules.',
[ ':handbook' => 'https://www.drupal.org/node/3273985',
]), MessengerInterface::TYPE_WARNING
);
} }