getSubmittedFilterFormat example



  /** * Validate callback to inform the user of CKEditor 5 compatibility problems. */
  public static function validateSwitchingToCKEditor5(array $form, FormStateInterface $form_state): void {
    if (!$form_state->get('ckeditor5_is_active') && $form_state->get('ckeditor5_is_selected')) {
      $minimal_ckeditor5_editor = Editor::create([
        '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;
        }

        
Home | Imprint | This part of the site doesn't use cookies.