While setting up question and answer content types, we came across the following error: "Related question field is required.". The problem was traced to the entityreference_prepopulate_get_values() function in entityreference_prepopulate.module. The function attempts to build the ids array first from cache, then from og_context, and finally from url. The problem was that when this code was run on the field_related_content field, the function entityreference_prepopulate_get_values_from_og_context() returns the group in the ids array. When the function validateReferencableEntities() runs on this it fails because it is looking for an entity_type of 'node' with a bundle of 'question' with the group nid rather than the question nid.
If I go into the Field UI for this field instance, there is a setting under 'Additional behaviors' called og_context. The description for this setting is: "Determine if values that should be prepopulated should "listen" to the OG-context." However, this setting is not being used by the entityreference_prepopulate_get_values() function.
The patch submitted with this issue checks the $instance array and only calls the entityreference_prepopulate_get_values_from_og_context() function if this setting has been checked.
Comment | File | Size | Author |
---|---|---|---|
#1 | entityreference-prepopulate-respect-og-context-2241509-0000-d7.patch | 1.42 KB | steven_corriveau |
Comments
Comment #1
steven_corriveau CreditAttribution: steven_corriveau commentedComment #2
steven_corriveau CreditAttribution: steven_corriveau commentedThis issue is fixed as of version 7.x-1.5.