Hi everyone,

I use this module but there is a warning that I wanted to get rid of.

Problem/Motivation

As I said, the problem was a warning on the node page. Here's the warning from a simplytest instance.
Notice: Undefined index: type in template_preprocess_field_slideshow() (line 977 of /home/s9d41c68951e977f/www/sites/default/modules/field_slideshow/field_slideshow.module)

Steps to reproduce :

  • Create a new simplytest instance with the field_slideshow module 7.x-2.x-dev
  • In a content type of your choice (Basic page for example), create a field type "image". Change the number of values for this field to whatever you like (This warning is displayed even if there is only one image)
  • Go to "Manage display" for this content type
  • In "Format", put "Slideshow"
  • Create a new Basic Page node and put images in the image field
  • Go to your newly created node
  • The warning should show up

Proposed resolution

The solution is to add a check for the "type" index. The only workaround for this without a patch is to disable errors in your Drupal administration

Remaining tasks

I'll propose a patch then some of you will need to review it.

Thank you.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

AndrackOSnack’s picture

AndrackOSnack’s picture

Title: Undifined index "type" when seeing a node using the field_slideshow » Undefined index "type" when seeing a node using the field_slideshow

khiminrm’s picture

#1 works for me

LaPi’s picture

#1 works for me too, thank you very much!

LaPi’s picture

Sorry, it's not true, I've got the same problem. I applied this patch and this one. When I saved the node there was no errors at all (yuppi!!!!!) but...no slideshow too (of course I checked: no field is set on "hidden"). After a simple refresh I got this error again...

Notice: Undefined index: type in template_preprocess_field_slideshow() (linea 934 di /var/www/geometratiboni.it/sites/all/modules/field_slideshow/field_slideshow.module).

Any ideas?

markabur’s picture

#1 works for me. I am just using a multi-value image field, no field collection.

Prashant Singhal’s picture

Assigned: AndrackOSnack » Unassigned
Status: Needs review » Reviewed & tested by the community

The patch works fine. Tested this locally. used git apply --index field_slideshow-undifined_index_type-2479977-1.patch , the patch applied cleanly. The patch does small check to see if $item["type"] is set or not.

robertgarrigos’s picture

Status: Reviewed & tested by the community » Needs work

I'm having this same problem and this patch solved it only partially. I'm getting two errors: in line 926 and line 976. this patch fixed error in line 976, but not 926

featherbelly’s picture

Status: Needs work » Reviewed & tested by the community

The patch works - is the error @robertgarrigos reports at line 926 is connected with $item["type"] being undefined?

@robertgarrigos - what is the error?

featherbelly’s picture

Status: Reviewed & tested by the community » Needs review

Maybe I spoke too soon - if it's the same error could need to add an isset to this line:-

elseif ($item["type"] == 'image') {

So it becomes:-

elseif ( isset($item["type"]) && $item["type"] == 'image') {

ndiSIGN’s picture

I was having the same notice on the same lines as #9.

After finding all kind of patching solutions I was reluctant to apply (one of) them, because the exact same setup was working perfectly on another site i've build, so I didn't really feel there needed something to be fixed.

My guess: the notice was created due to changing all kind of settings during the setup process and therefor eventually the index got corrupted.

My solution: I uninstalled both the field_collection and field_slideshow module and decided to start over. This time I entered all neccesary information correct the first time without changing settings afterwards/during the setup process. This did the trick! It's working as expected/designed now.

The fix for the module could be in the area of avoiding messing up the index by changing fields during setup.

Hope to help someone with this solution.

lamp5’s picture

Assigned: Unassigned » lamp5