'format' => NULL,
'editor' => 'ckeditor5',
]);
$submitted_filter_format = CKEditor5::
getSubmittedFilterFormat($form_state);
$fundamental_incompatibilities = CKEditor5::
validatePair($minimal_ckeditor5_editor,
$submitted_filter_format, FALSE
);
foreach ($fundamental_incompatibilities as $violation) { // If the violation uses the nonAllowedElementsMessage template, it can
// be skipped because this is a violation that automatically fixed
// within SmartDefaultSettings, but SmartDefaultSettings does not
// execute until this validator passes.
if ($violation->
getMessageTemplate() ===
$violation->
getConstraint()->nonAllowedElementsMessage
) { continue;
} // @codingStandardsIgnoreLine
$form_state->
setErrorByName('editor][editor',
t($violation->
getMessageTemplate(),
$violation->
getParameters()));
} } } /**
* Value callback to set the CKEditor 5-generated "allowed_html" value.
*
* Used to set the value of filter_html's "allowed_html" form item if the form
* has been validated and hence `ckeditor5_validated_pair` is available
* in form state. This allows setting a guaranteed to be valid value.
*
* `ckeditor5_validated_pair` can be set from two places:
* - When switching to CKEditor 5, this is populated by
* CKEditor5::buildConfigurationForm().
* - When making filter or editor settings changes, it is populated by
* CKEditor5::validateConfigurationForm().
*
* @param array $element
* An associative array containing the properties of the element.
* @param mixed $input
* The incoming input to populate the form element. If this is FALSE,
* the element's default value should be returned.
* @param \Drupal\Core\Form\FormStateInterface $form_state
* The current state of the form.
*
* @return string
* The value to assign to the element.
*/