When attempting to export a content type (using content_copy.module) that has a nodereference field that doesn't allow multiple values, I get the following errors:

  • NodeReference Field : This post can't be referenced.
  • The default value is invalid.

Steps to reproduce:

  1. Enable the Content, Content Copy, and Node Reference modules.
  2. Create a new content type, and add a node reference field to it. Do not set the field to allow multiple values.
  3. Attempt to export the content type.

Result:

The export data for the content type, but none of its fields, is shown. In addition, the error messages described above are displayed.

Investigation:

It appears that when the field settings form is called from drupal_execute and the field is not marked multivalue, the $items[0]['nid'] parameter in nodereference_field('validate', ...) is an array. When the field is marked multivalue, however, or when called from drupal_get_form regardless of the multivalue setting, $items[0]['nid'] is an integer.

Comments

TheMystic’s picture

I should note that this doesn't occur with the autocomplete widget, only with the select widget.

raspberryman’s picture

Exact same steps to reproduce for me.

scor’s picture

Status: Active » Closed (duplicate)