Media overwrites validation constraints

Created on 27 February 2024, 4 months ago
Updated 10 June 2024, 7 days ago

Problem/Motivation

I am using media_remote module and wanted to add validation constraint plugin to one field for certain media/bundle combination. I realized that my validation constraint wasn't triggered as it was removed by core media module.

Steps to reproduce

Create validation constraint plugin. Add it to a media source field by using hook_entity_bundle_field_info_alter(). That custom validation constraint will be overwritten in validate() function of web/core/modules/media/src/Entity/Media.php.

Proposed resolution

In validate() function of web/core/modules/media/src/Entity/Media.php instead of using setConstraints() we could use addConstraint(), thus leaving any existing validation constraints intact.

πŸ› Bug report
Status

Active

Version

11.0 πŸ”₯

Component
MediaΒ  β†’

Last updated 1 day ago

Created by

πŸ‡·πŸ‡ΈSerbia miksha

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

Merge Requests

Comments & Activities

Production build 0.69.0 2024