Problem/Motivation

Oversight in #3382510: Introduce a new #config_target Form API property to make it super simple to use validation constraints on simple config forms, and adopt it in several core config forms.

Surfaced by @alexpott in #3398982: ConfigFormBase + validation constraints: support non-1:1 form element-to-config property mapping again at https://git.drupalcode.org/project/drupal/-/merge_requests/5240/diffs#no...

Steps to reproduce

Two #config_targets with the same targeted property path currently just overwrite each other 😬

Proposed resolution

Throw a \LogicException with a helpful message.

Remaining tasks

  1. Tests.
  2. Fix.
  3. Reviews.

User interface changes

None.

API changes

None.

Data model changes

None.

Release notes snippet

None.

Issue fork drupal-3401186

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

Wim Leers created an issue. See original summary.

wim leers’s picture

Status: Active » Needs review
wim leers’s picture

Issue summary: View changes
borisson_’s picture

Status: Needs review » Reviewed & tested by the community

I'm not sure about the error message here, it limits to two, while there could be even more. It is the tiniest of nitpicks though, so setting rtbc regardless.

phenaproxima’s picture

No notes! +1 RTBC here.

alexpott made their first commit to this issue’s fork.

alexpott’s picture

@borisson_ given we're looping through here we can only detect one clash at a time. But once you've removed one - if there is another clash we'll throw another exception.

alexpott’s picture

Version: 11.x-dev » 10.2.x-dev
Category: Task » Bug report
Status: Reviewed & tested by the community » Fixed

Committed and pushed 40084a52b03 to 11.x and 23141ce25e6 to 10.2.x. Thanks!

Backported to 10.2.x because this is a bugfix to a feature.

  • alexpott committed b7540532 on 11.x
    Issue #3401186 by Wim Leers, alexpott: Follow-up for #3382510: Throw \...

  • alexpott committed 23141ce2 on 10.2.x
    Issue #3401186 by Wim Leers, alexpott: Follow-up for #3382510: Throw \...

Status: Fixed » Closed (fixed)

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