When editing a node that uses a view reference field within a file collection we see:

Notice: Undefined index: arguments in viewreference_autocomplete_process() (line 927 of /.../sites/all/modules/contrib/viewreference/viewreference.module).

When saving we see:

Notice: Undefined index: skip_default in viewreference_autocomplete_validate() (line 339 of /.../sites/all/modules/contrib/viewreference/viewreference.module

There are just a couple of instances where array keys are being accessed without any checks to make sure actually exist first. Rolling a patch now...

Comments

srycroft’s picture

Status: Needs work » Needs review
StatusFileSize
new2.6 KB

This patch fixes it for me

srycroft’s picture

After further testing I discovered the same issue occurred when using the select list widget. Here is a revised patch that fixes both use cases.

james.williams’s picture

StatusFileSize
new3.79 KB

The above patches don't actually respect the arguments settings when disabled, as they just check for isset() rather than checking the value with !empty().
Also, #parents is used at the top of the elements process functions to get the field name & language, but these assume knowledge of the structure of the form containing our element, which in some cases will be different - so Field API provides #field_name and #language for this very purpose anyway.

The attached patch should sort both of these notice-generating problems out.

pglynn’s picture

Seems like there's more than one solution to this. Would like to see this roll out in the beta version sometime soon since both of these approaches seems to fix the errors stemming from adding a viewreference field to a field collection. Here's another approach that works: https://drupal.org/node/1790304#comment-7395496

danielb’s picture

Issue summary: View changes
Status: Needs review » Fixed
danielb’s picture

Status: Fixed » Active
danielb’s picture

Had to ditch that patch, just causes a heap of errors

danielb’s picture

Status: Active » Closed (duplicate)

I think we'll continue this here https://drupal.org/node/1790304#comment-7395496