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

davidseth’s picture

Assigned: Unassigned » davidseth
Category: feature » bug

Hello. Thanks for this report. I will fix this shortly.

davidseth’s picture

Status: Active » Needs review

Thanks. I have just committed this code. Please test. I have configured it to now work with entity references and node references.

G Gavitt’s picture

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

davidseth’s picture

Status: Needs review » Closed (fixed)

Great, thanks for testing that!