Problem/Motivation
When creating media, it is currently not possible to save the form due to an error. The error message reads as follows: TypeError: implode(): Argument #1 ($pieces) must be of type array, string given in implode() (line 29 of /app/web/core/lib/Drupal/Core/Form/FormElementHelper.php)
.
Steps to reproduce
1. Add the entity_reference field to Media, and use the media library widget.
2. Set the alt text mandatory.
3. Open the Node form
4. Click "Add media"
5. Choose an image and try to save the media. Nothing happens and there is an error in the Watchdog.
6. If the "Alt text" has been added -- no errors, the form works correctly and media have been created.
Proposed resolution
Provide a patch to avoid errors in the validation process.
The correct work is when you try to save media without filling the mandatory field for Alternative text -- you get an error: