I have created new media type(movie image). In that media type, I have two fields image and boolean field,

I have referenced the movie image in content type and set upload limit of images to 10 and set the form-display to media-library. I have a requirement where the user can upload multiple images and select one image as the cover image. I have used entity validation API and created my own constraint and constraint validation. The validation is working fine if the user marks more than one cover image, but after the error is set I can't remove the image from the widget. I'm getting these errors

Undefined index: removed_item_id in Drupal\media_library\Plugin\Field\FieldWidget\MediaLibraryWidget::updateWidget()

Error: Call to a member function label() on null in Drupal\media_library\Plugin\Field\FieldWidget\MediaLibraryWidget::updateWidget()

Thank you

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.