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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

steven_corriveau’s picture

steven_corriveau’s picture

Assigned: steven_corriveau » Unassigned
Status: Active » Fixed

This issue is fixed as of version 7.x-1.5.

Status: Fixed » Closed (fixed)

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