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.
Command icon 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

joelpittet created an issue. See original summary.

  • joelpittet committed 2d5bbc48 on 2.x
    test: #3558395 Attach conflict validation errors to configured field and...
joelpittet’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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