Hi,

I get these errors when editing a node:

Notice: Undefined index: #options in nat_form_alter() (line 189 of \sites\all\modules\nat\nat.module).
Warning: array_diff_key() [function.array-diff-key]: Argument #1 is not an array in nat_form_alter() (line 189 of \sites\all\modules\nat\nat.module).

I'm using drupal 7.7

Comments

Zen’s picture

jaypark’s picture

Status: Closed (duplicate) » Needs work

This is not a duplicate of http://drupal.org/node/1190038, however it may be a symptom of that issue.

This notice and warning comes from nat.module::line194 (March 4 dev version):

$form[$form_field][$language]['#options'] in fact doesn't exist if the form widget doesn't provide the #options array. This is true for the term_reference_tree module, which provides a very nice term reference control, as #type => 'checkbox_tree'. as you can see from drupal 7 form api, there is no #option array available for #type => 'checkbox_tree' (in fact there's no reference at all to that type at http://api.drupal.org/api/drupal/developer!topics!forms_api_reference.ht...)

the issue is that NAT is unaware of what kind of widget is providing the terms. this awareness should probably happen at admin/structure/nat/fields.

fabianderijk’s picture

Status: Needs work » Needs review

I've made a patch for this. All still works, it just doesn't throw the error.

fabianderijk’s picture

fabianderijk’s picture

StatusFileSize
new788 bytes

Now with a correct patch

Anonymous’s picture

Issue summary: View changes
StatusFileSize
new772 bytes

changed patch #5 a little: this patch works in the module directory

brooke_heaton’s picture

StatusFileSize
new323.7 KB

I was able to recreate this error on a content type with a term reference field using the term_reference_tree widget.

  1. Content type has a term reference field and the vocabulary of this field is configured for NAT
  2. Create a node of the above content type, adding a value to the NAT configured vocab term reference field
  3. Edit the saved node - the error will appear
brooke_heaton’s picture

Status: Needs review » Reviewed & tested by the community

Patch in #6 works for me. RTBC.