Line 98 on multiselect.module assumes there's always some nid associated with item,

so it'll give warning/error when entity reference is used.

CommentFileSizeAuthor
#2 multiselect-1864062-use_column_name-2.patch877 bytesJvE
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jdleonard’s picture

Agreed. I think we need to check the field type and if it's an entity reference, use target_id instead of nid

JvE’s picture

Status: Active » Needs review
FileSize
877 bytes

Attached a patch to use the $value_key rather than nid.

anou’s picture

Title: nid is not available for target_id fields » Notice : Undefined index: nid in multiselect_field_widget_form() [nid is not available for target_id fields]

Hello,
I didn't saw your post (and patch) before doing this one. I did it for multiple issues and also for this one. I though to mention it here because I think it's related (not duplicate).

I changed the title because I think it's easier to find your post with the PHP error. Change it back if I'm wrong.
Cheers.

jdleonard’s picture

Status: Needs review » Reviewed & tested by the community

Patch makes sense and works as expected. Thanks!