Problem/Motivation
I have what may be an unusual use case in which I've got an entity reference field that references paragraph types. With the select2_publish module enabled, this widget shows all available entities in red. I assume the problem is that paragraph types have no published status.
Steps to reproduce
Install paragraphs and select2_publish. Create some paragraph types, and then create a "Reference -> Other..." field. Select "Paragraph Type" as the target entity type. Configure the field's widget to use Select2, and then check the options available in the field. They will all be listed in red.
Proposed resolution
One option would be for the widget configuration to allow enabling/disabling published status styling. Another might be to disable this functionality automatically if the target entity type doesn't have a property indicating published or unpublished status.
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | 3164601-publish-status.patch | 1.06 KB | wrd |
| #3 | Screen Shot 2020-08-13 at 9.02.18 AM.png | 162.31 KB | wrd |
Comments
Comment #2
chr.fritschI tried it like you described it, and didn't got any red entries.
I also checked the code and the select2_publish functionality only appears, if the entity type implements the EntityPublishedInterface, which the ParagraphsType doesn't.
Comment #3
wrd commentedI can still duplicate the issue. What you see here are two entity reference fields. The first is referencing nodes, and the selections appear in black. The second is referencing paragraph types, and the selections appear in red. The "unpublished" class is present on the items.
What would be most useful in further diagnosing the problem? I could export the field and field storage configurations if that would help.
Comment #4
chr.fritschThat was the missing hint :)
That there needs to be another field that actually has a publishing state :)
Here is a fix: https://github.com/thunder/select2/pull/93
Comment #5
wrd commentedAha! Thank you :)
I'm not certain how to incorporate this change into composer.json the way I would a patch file, but I think I've generated one correctly from your branch.
Comment #6
wrd commentedYup, that solves my problem! Thanks!
Comment #7
chr.fritschSetting to RTBC based on #6. Thx for testing
Comment #9
chr.fritschCommitted