Get a Undefined index: type in views_load_more_views_ajax_data_alter() (line 52 of /sites/all/modules/views_load_more/views_load_more.module). after update from 7.x-1.1+23-dev

i don't get a warning or error message but my recent log messages is filled with the notice.

Comments

Maks’s picture

Same here

liquidgnome’s picture

        if ($view->style_plugin->options['type'] == 'ul' || $view->style_plugin->options['type'] == 'ol') {
          $target = ".{$view->style_plugin->options['wrapper_class']} > {$view->style_plugin->options['type']}:not(.links)";
          $commands[$key]['targetList'] = $target;
        }

i wound up commenting these lines out, as i'm not using a style plugin at all, and it appears as though the array key not being set is going to cause problems for fairly straightforward views_load_more usage until it's fixed.

just commenting the lines out seems to do the trick in lieu of actually checking to see if the ['type'] key is present for the time being.

marcoscano’s picture

StatusFileSize
new885 bytes

Just checking for the 'type' key solved the problem for me

patch attached

marcoscano’s picture

Status: Active » Needs review
Maks’s picture

After applying the patch #3 problem disappeared.
Many thanks, marcoscano!

maximpodorov’s picture

Status: Needs review » Reviewed & tested by the community

Obvious fix. Please commit.

subadmin’s picture

Thanks #3 @marcoscano working fine :)

ptmkenny’s picture

Closed #2235949: Undefined index: type in views_load_more_views_ajax_data_alter() (row 52 as a duplicate, although there is a separate patch there

basvredeling’s picture

I gave it some thought and I have to say I like the approach I proposed in #2235949: Undefined index: type in views_load_more_views_ajax_data_alter() (row 52 better. It doesn't just fix the error at hand, it allows for individual handling of different views display modes. This issue is only here because the display mode is not an HTML list. Instead of solving the symptom of the type index, we should single out lists completely and handle stuff like tables in a different manner. They might require an extra index themselves. Which would lead us to go back and refactor this tiny fix again...

m4olivei’s picture

Version: 7.x-1.2 » 7.x-1.x-dev
Assigned: Unassigned » m4olivei
Status: Reviewed & tested by the community » Needs review
StatusFileSize
new1.19 KB

I agree with basvredeling, and I needed to re-roll the patch against the latest 7.x-1.x release anyway, so here is a new patch.

What do you all think? Let me know and I shall commit it if it looks OK.

Thanks,
Matt

m4olivei’s picture

StatusFileSize
new1.32 KB

Re-roll against current 7.x-1.x

m4olivei’s picture

Status: Needs review » Closed (fixed)

On second thought, I'm just going to commit. Pretty safe patch here.

Patch #11 committed to 7.x-1.x-dev.

Thanks!

Anonymous’s picture

@m4olivei after updating to the latest dev am still getting the notice.

m4olivei’s picture

@Dhamub looks like the packaged dev release is behind the 7.x-1.x branch ATM. Not sure on what schedule that updates. Can you try grabbing the 7.x-1.x branch from Git?