I have 2 content types : photo and photo_gallery. In the photo type, there is one nodereference field (widget: reference from url) that will reference the photo_gallery nodes.

I then add one nodereference count field in the photo_gallery to show the number of photos in each gallery. In the field configuration page, after saving, I got the error message:

Notice: Undefined index: photo_gallery in nodereference_count_field_options() (line 39 of ***/sites/all/modules/nodereference_count/nodereference_count.module).

Even though there is the above error message, everthing works fine. The result of photo numbers is showing correctly and there is no other error messages elsewhere.

Comments

gilgabar’s picture

Thanks for spotting this. I was able to reproduce and the fix should be pretty straightforward, but please test it out to be sure. Try replacing line 39 with this:

if ($field_type['type'] == 'node_reference' && isset($field_type['settings']['referenceable_types'][$bundle]) && $field_type['settings']['referenceable_types'][$bundle] === $bundle) {

The issue is that there is another node reference field that was created before your photo_gallery content type existed, so the photo_gallery type name does not appear in that field's list of referenceable types (it doesn't matter whether it is selected or not). The patch just makes sure that the index for the type name is set before it checks to see if it is also selected.

danny1997’s picture

Status: Active » Fixed

@gilgabar :

I just tested the above codes. It removes the error notice and everything works fine now.

Thanks for your help.

Happy new year!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

add : widget type is reference from URL