The code that handles the field type is becoming long and convoluted. Convert to a switch statement to make it cleaner and clearer.

Comments

slydevil created an issue. See original summary.

slydevil’s picture

Status: Active » Needs review
StatusFileSize
new4.73 KB

Patch added, which includes the patches from all 4 related tickets.

slydevil’s picture

StatusFileSize
new4.71 KB

Patch #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.

slydevil’s picture

slydevil’s picture

StatusFileSize
new4.73 KB
new4.75 KB

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

el1_1el’s picture

StatusFileSize
new5.97 KB

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

el1_1el’s picture

StatusFileSize
new5.54 KB

that 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?

nickdickinsonwilde’s picture

Assigned: slydevil » Unassigned
Status: Needs review » Fixed

Thanks for the patches! Merged.

Status: Fixed » Closed (fixed)

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