Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Follow-up to #2413641: Add OptionWidgets for single value target type DER fields
Problem/Motivation
target type select doesn't make sense when DER has only one target type.
Proposed resolution
Remove target_type select form dynamic_entity_reference_default widget.
Remaining tasks
Write and fix tests.
User interface changes
Simple autocomplete field for DER with on target type
API changes
None
Comment | File | Size | Author |
---|---|---|---|
#22 | hide_entity_type-2448401-22-8.x-2.x.patch | 11.47 KB | JeroenT |
| |||
#15 | hide_entity_type-2448401-15.patch | 8.72 KB | JeroenT |
|
Comments
Comment #1
jibranlol @ last patch.
Comment #5
jibranComment #6
JeroenTPatch no longer applied. Created a new patch.
Comment #8
JeroenTCreated a new patch. Let's see if this fixes the failed tests.
Comment #10
jibran'value' is safer than 'hidden'. See https://api.drupal.org/api/drupal/developer%21topics%21forms_api_referen... and https://api.drupal.org/api/drupal/developer%21topics%21forms_api_referen... for more details.
Comment #11
JeroenTLet's see if this fixes the tests.
Comment #12
JeroenTThis is the right patch.
Comment #13
JeroenTComment #14
jibranGreat work @JeroenT. Just one point after that I think it is ready.
Let's assert selectNotExists or something similar to make sure it is not on the page.
Comment #15
JeroenTFixed remarks given in #14.
Comment #16
jibranI have done manual testing. It works great. This is RTBC for me. Can you please upload the patch for 8.x-2.x branch?
Comment #17
JeroenTTo be clear:
Patch in #15 is for 8.x-1.x
Patch in #17 is for 8.x-2.x
Comment #19
JeroenTWill look at the 8.x-2.x patch this evening.
Comment #20
JeroenTComment #21
jibranThanks for the patch.
Seems like we are missing this from 2.x patch.
Comment #22
JeroenTThe problem in DynamicEntityReferenceWidget test was that in 8.x-2.x there are multiple target_types instead of 1 as in 8.x-1.x. Moved adding of the config_test target_entity to method testEntityReferenceDefaultWidget.
Edit: Should be tested against 8.x-2.x of course..
Comment #23
JeroenTComment #25
JeroenT2 green patches again.
#15 = 8.x-1.x
#22 = 8.x-2.x
Comment #26
jibranI think tests changes from #2829602: Disable optgroup in select list when only 1 target_bundle is available. also got into this patch other then that this is RTBC.
Comment #27
JeroenT@jibran,
These are not the same changes as in #2829602: Disable optgroup in select list when only 1 target_bundle is available.. I added these changes in
testEntityReferenceDefaultWidget
so I can test if the target_type select is present when you can reference multiple entity types and not present when you can reference only 1 entity type. I also had to add this to test the reference with config entitites.Comment #28
jibranOh! got it. Thanks for explanation. This is also ready.
Comment #30
jibranI committed #22 to 8.x-2.x.
Comment #31
JeroenTGreat!
Comment #32
JeroenTPutting back to RTBC because this patch is not committed to 8.x-1.x.
Comment #33
jibranPushed to 8.x-1.x