The code that handles the field type is becoming long and convoluted. Convert to a switch statement to make it cleaner and clearer.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | if_to_switch-8.x-1.x-dev-2937114-7.patch | 5.54 KB | el1_1el |
| #6 | if_to_switch-8.x-1.x-dev-2937114-6.patch | 5.97 KB | el1_1el |
| #5 | if_to_switch-8.x-1.x-dev-2937114-5.patch | 4.75 KB | slydevil |
| #5 | if_to_switch-8.x-1.0-rc2-2937114-5.patch | 4.73 KB | slydevil |
Comments
Comment #2
slydevil commentedPatch added, which includes the patches from all 4 related tickets.
Comment #3
slydevil commentedPatch #2 applies to the current code base in the 8.x-1.x branch, which is currently several commits ahead of the 8.x-1.0-rc2 release. I've attached a new patch that can be applied to the 8.x-1.0-rc2 release.
Comment #4
slydevil commentedComment #5
slydevil commentedNew patches to cover the link type field.
if_to_switch-8.x-1.0-rc2-2937114-5.patch is to patch the rc2 release.
if_to_switch-8.x-1.x-dev-2937114-5.patch is to patch the dev branch.
Comment #6
el1_1el commentedI came across this while developing a module based on entity_reference_autocomplete with this module enabled. Although I think adding specific types and plugin_ids to switch statements could get unruly, having sensible defaults is a must.
I rerolled the patch in 5 to have defaults for unknown plugin_ids of type entity_reference.
Comment #7
el1_1el commentedthat may not be the most sensible default. since most entity reference fields would be target_id, maybe a dupe of
case 'entity_reference_autocomplete':with a log message instead?Comment #9
nickdickinsonwildeThanks for the patches! Merged.