Problem/Motivation
Resource Conflict currently always sets a generic form error message when a conflict
is detected, instead of attaching the error to the configured date field. This makes
it harder for editors to see which field needs fixing, and for contrib modules or
site-specific listeners to replace the default message cleanly via the
NodeValidationEvent.
Proposed resolution
-
Update
resource_conflict_node_form_validate()to build the conflict
message once and attach it to the configured field using
$form_state->setError()when the field exists, falling back to
setErrorByName()when it does not. -
Add a small test module with a
ResourceConflictValidationSubscriber
that sets its own validation error based on detected conflicts. -
Add a functional test to verify that, when bundle settings disable the default
form error, the subscriber’s error message is shown instead and the node is
not saved. -
Clean up the test setup by using typed class constants and entity type storage
services for creating field storage and field config entities.
Issue fork resource_conflict-3558395
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
joelpittet