Closed (fixed)
Project:
Entityreference Browser
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
15 Apr 2012 at 02:48 UTC
Updated:
6 May 2012 at 23:25 UTC
I tried out this module with in conjunction with the reference module. Everything works fine except the Node reference field that uses the node reference widget will not save the nid after a node edit.
As a work around I changed this function in entityreference_browser.module
function entityreference_browser_validate($element, &$form_state) {
$value = array();
if (!empty($element['#value'])) {
$ids = explode(',', $element['#value']);
$value = array();
foreach ($ids as $id) {
$value[] = array(
'nid' => $id,
);
}
}
Specifically 'nid' => $id, was 'target_id' => $id. That fixes the problem for me but probably breaks it for the regular entity reference module.
A better fix might be to check for the widget type in $element? I tried setting up a file browser field to test but didn't have much luck getting the view to work however, regular node browser views are a breeze to setup.
Comments
Comment #1
davidseth commentedHello. Thanks for this report. I will fix this shortly.
Comment #2
davidseth commentedThanks. I have just committed this code. Please test. I have configured it to now work with entity references and node references.
Comment #3
G Gavitt commentedI just did a quick test with the new commit on a complicated form page. I had no problems saving a node reference field. TY for the commit.
Comment #4
davidseth commentedGreat, thanks for testing that!