Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 303301

make the 'group' property on EntityReferenceSelection plugins implicitly derived

$
0
0

Problem/Motivation

The interplay between the plugin ID and the group property on EntityReferenceSelection plugins is weird.

Despite improving the docs for this #2945789: Document quirks of Entity reference selection plugins while a fix is figured out, it's still confusing #3270898: Misleading documentation in \Drupal\Core\Entity\Annotation\EntityReferenceSelection. There is a long-standing issue to fix it #2649712: Entity reference selection plugins break when not following a weird ID pattern but no way forward.

I have an alternative suggestion: since the group property MUST conform to a certain pattern, remove it from the plugin attribute and derive it in the plugin manager.

The current rule is:

- group and id must be identical, OR
- if id is of the form foo:bar, group must be foo

Therefore, we can remove the group property from the attribute and set it in the plugin manager like this:

- if id does not contain a ':', set group to the same as the id
- if id is of the form foo:bar, set group to foo

We keep the concept of group, because it's used by EntityReferenceItem (see my comments on #3270898: Misleading documentation in \Drupal\Core\Entity\Annotation\EntityReferenceSelection for an explanation), but it's now impossible to get it wrong.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet


Viewing all articles
Browse latest Browse all 303301

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>