Problem/Motivation

#limit_validation_errors causes some issues in this module. For example, if the content type contains any 'select' field, we are getting an error when clicking on the Sidekick button.

```
TypeError: Drupal\Core\Field\WidgetBase::massageFormValues(): Argument #1 ($values) must be of type array, string given, called in /var/www/web/core/lib/Drupal/Core/Field/WidgetBase.php on line 386 in Drupal\Core\Field\WidgetBase->massageFormValues() (line 534 of /var/www/web/core/lib/Drupal/Core/Field/WidgetBase.php)
```

The problem originates from the Drupal core bug, which triggers under specific circumstances. Circumstances are:

- AJAX is used
- #limit_validation_errors is used
- $entity_form_display->extractFormValues( is used in AJAX callback

And that's exactly the case in the sidekick module. Some related issues are:

https://www.drupal.org/project/drupal/issues/3155438
https://www.drupal.org/project/commerce/issues/3136525

Comments

dejan0 created an issue. See original summary.

dejan0’s picture

Temporarily patch is here, it disables #limit_validation_errors. Not ideal, as validation errors now might be triggered during AJAX call (Sidekick button), and visible on the next page. And that might be just confusing for editors... But yes, at least Sidekick now works, and no more errors. Let's see if we can find a better solution here

shyam-sawhney’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.