Problem/Motivation

There is something weird about "Data from field" source plugin: it is available for props without a type. Or, more precisely, to props of type UnknownPropType because we have such prop type

Tested with the first props of https://git.drupalcode.org/project/ui_patterns/-/blob/2.0.x/tests/module...

Props without prop types are not expected to have sources, prop without sources are not expected to show up in the form.

Proposed resolution

So, what do we do ? We fix "Data from field" to avoid targeting UnknownPropType" ? Or we challenge the relevancy of "UnknownPropType" plugin ?

CommentFileSizeAuthor
unknwon-prop-type.png19.1 KBpdureau
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

pdureau created an issue. See original summary.

Christian.wiedemann made their first commit to this issue’s fork.

christian.wiedemann’s picture

I see folowing possible solutions:

  • In SourcePluginManager::getDefinitionsForPropType: if ($prop instanceOf UnknownPropType) {return [];}
  • Add prop types to EntityFieldSource via alter hook and make prop_type required.
  • Add a is isApplicable method to the source. (We had something like this before. :))
christian.wiedemann’s picture

@just_like_good_vibes: I need your 5 cents here :)

just_like_good_vibes’s picture

my question, why do we need unknownPropType ? sorry i forgot.
if it is an hardcoded edge case, where no sources should be shown,
my favorite solution between the three solutions proposed would be : "In SourcePluginManager::getDefinitionsForPropType: if ($prop instanceOf UnknownPropType) {return [];}"

pdureau’s picture

christian.wiedemann’s picture

Assigned: christian.wiedemann » just_like_good_vibes
Status: Active » Needs review

I added the if.

just_like_good_vibes’s picture

Pierre, would you review please :)?

pdureau’s picture

Assigned: pdureau » Unassigned
Status: Needs review » Fixed
pdureau’s picture

Status: Fixed » Closed (fixed)
christian.wiedemann’s picture