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

Comments

wrd created an issue. See original summary.

chr.fritsch’s picture

Status: Active » Postponed (maintainer needs more info)

I 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.

wrd’s picture

StatusFileSize
new162.31 KB

I 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.

chr.fritsch’s picture

Status: Postponed (maintainer needs more info) » Needs review

That 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

wrd’s picture

StatusFileSize
new1.06 KB

Aha! 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.

wrd’s picture

Yup, that solves my problem! Thanks!

chr.fritsch’s picture

Status: Needs review » Reviewed & tested by the community

Setting to RTBC based on #6. Thx for testing

  • chr.fritsch authored d060c72 on 8.x-1.x
    Issue #3164601 by wrd, chr.fritsch: Improve presentation of entity...
chr.fritsch’s picture

Status: Reviewed & tested by the community » Fixed

Committed

Status: Fixed » Closed (fixed)

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