Problem/Motivation
DER doesn't support OptionWidgets.
Proposed resolution
To make DER inline with ER let's add OptionWidgets for single value target type fields(for simplicity).
This also fixes some nasty bugs in DERItemList and DERItem which I found while fixing this.
Remaining tasks
Review
User interface changes
This patch adds the following widgets:






API changes
Hmmm let me think.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | add_optionwidgets_for-2413641-8.patch | 23.53 KB | jibran |
| #8 | interdiff.txt | 2.89 KB | jibran |
Comments
Comment #1
jibranDo not test patch is without #2411981: Fixes after generic 'entity_autocomplete' Form API element fix.
Comment #2
larowlanNeat
Cool trick
Is there somewhere we're checking the user has access to the entity label? E.g. we don't want to be showing node titles if the node is unpublished and the user doesn't have access. Similar stuff to what we do with formatters. I assume it defers to something in ER in core? But best check because otherwise we might have security issue.
What happens if there are 1000s of nodes and someone (stupidly) uses this? Should we check that in the is available method too? To make sure that people don't bust their site.
Comment #3
jibranFrom
DynamicEntityReferenceItem::getSettableOptions()so the answer is we are getting reference-able entities form ER selection plugins in core which are completely secure.
Isn't ER has the same problem? We can create evil like views_field_view.
Comment #4
jibranNow select list supports option groups.
Comment #5
jibranAdded tests for defaultValues.
Comment #6
jibranAnd we have a core bug.
Comment #8
jibranCreated #2426781: Custom OptionWidget have no empty option label for fails in #6. Meanwhile the work around.
Comment #9
jibranComment #10
larowlanjibran+=1000
love the new test coverage
Comment #11
jibranThanks for the review and kind words.
Comment #13
jibran