Fix TypeError when editing Text formats and editors for the Cl Component Embed filter having Argument #1 ($input) must be of type array, null given

Created on 1 July 2023, over 1 year ago
Updated 18 July 2023, over 1 year ago

Problem/Motivation

Can not save edits on text format with CL Block
TypeError in the Cl Component Embed filter while modifying Text formats and editors.

The filter currently encounters Argument #1 ($input) must be of type array, but it receives a null value instead.

Steps to reproduce

Given the CL Block was enabled in a Drupal ~10.1.0 site
And navigate to edit a text format ( Full HTML ) for example
When I press the "Save Configuration" submit button
Then the following error message shows up "The website encountered an unexpected error. Please try again later."

TypeError: Drupal\cl_block\Plugin\Filter\ClComponentEmbed::Drupal\cl_block\Plugin\Filter\{closure}(): Argument #1 ($input) must be of type array, null given, called in /var/www/html/dev/drupal10-1-0/docroot/modules/contrib/cl_block/src/Plugin/Filter/ClComponentEmbed.php on line 159 in Drupal\cl_block\Plugin\Filter\ClComponentEmbed->Drupal\cl_block\Plugin\Filter\{closure}() (line 156 of modules/contrib/cl_block/src/Plugin/Filter/ClComponentEmbed.php).
Drupal\cl_block\Plugin\Filter\ClComponentEmbed->setConfiguration(Array) (Line: 162)
Drupal\Core\Plugin\DefaultLazyPluginCollection->setInstanceConfiguration('cl_block', Array) (Line: 165)
Drupal\filter\Entity\FilterFormat->setFilterConfig('cl_block', Array) (Line: 765)
Drupal\ckeditor5\Plugin\Editor\CKEditor5::getSubmittedFilterFormat(Object) (Line: 789)
Drupal\ckeditor5\Plugin\Editor\CKEditor5->getEventualEditorWithPrimedFilterFormat(Object, Object) (Line: 628)
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: 593)
Drupal\Core\Form\FormBuilder->processForm('filter_format_edit_form', Array, Object) (Line: 325)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object) (Line: 39)
Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 583)
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: 166)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 74)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 54)
Drupal\simple_oauth\HttpMiddleware\BasicAuthSwap->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: 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)

Proposed resolution

  • Check on empty values when editing for the first time
  • Not sure if the list of components should show up to be allowed in the Editor ( So cooool feature by the way )

Remaining tasks

  • File an issue
  • Patch/MR
  • Test
  • Review

User interface changes

  • N/A

API changes

  • N/A

Data model changes

  • N/A
πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡―πŸ‡΄Jordan Rajab Natshah Jordan

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

Comments & Activities

Production build 0.71.5 2024