clean value generate integer in place of boolean in highlight module

Created on 19 August 2024, 4 months ago

Problem/Motivation

In drupal 10 , when i want to activate the highlight option in ckeditor5 toolbar i have this error.

AssertionError: Schema errors: Array ( [editor.editor.id_does_not_matter:settings.plugins.ckeditor5_plugin_pack_highlight__highlight.use_default_markers] => variable type is integer but applied schema class is Drupal\Core\TypedData\Plugin\DataType\BooleanData ) in assert() (line 742 of core/modules/ckeditor5/src/Plugin/Editor/CKEditor5.php).
Drupal\ckeditor5\Plugin\Editor\CKEditor5->validateConfigurationForm(Array, Object) (Line: 211)
editor_form_filter_admin_format_validate(Array, Object)
call_user_func_array('editor_form_filter_admin_format_validate', Array) (Line: 82)
Drupal\Core\Form\FormValidator->executeValidateHandlers(Array, Object) (Line: 275)
Drupal\Core\Form\FormValidator->doValidateForm(Array, Object, 'filter_format_edit_form') (Line: 118)
Drupal\Core\Form\FormValidator->validateForm('filter_format_edit_form', Array, Object) (Line: 69)
Drupal\autosave_form\Form\AutosaveFormValidator->validateForm('filter_format_edit_form', Array, Object) (Line: 593)
Drupal\Core\Form\FormBuilder->processForm('filter_format_edit_form', Array, Object) (Line: 144)
Drupal\autosave_form\Form\AutosaveFormBuilder->processForm('filter_format_edit_form', Array, Object) (Line: 325)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 97)
Drupal\autosave_form\Form\AutosaveFormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 592)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 43)
Drupal\force_password_change\Service\ForcePasswordChangeRedirectMiddleware->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 50)
Drupal\ban\BanMiddleware->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Steps to reproduce

Proposed resolution

/**
   * {@inheritdoc}
   */
  public function submitConfigurationForm(array &$form, FormStateInterface $form_state): void {
    $values = $form_state->cleanValues()->getValues();
    $this->configuration['options'] = $values['custom_marker_wrapper'] ?? [];
    $this->configuration['use_default_markers'] = (bool) $values['use_default_markers'];
  }

It's done like this in others ckeditor plugin pack sub modules . ex: web/modules/contrib/ckeditor5_plugin_pack/modules/ckeditor5_plugin_pack_font/src/Plugin/CKEditor5Plugin/FontColor.php

🐛 Bug report
Status

Active

Version

1.2

Component

Code

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024