Notice: Undefined index: views_slideshow_cycle in theme_views_slideshow_controls_widget_render() (line 291 of /views_slideshow/theme/views_slideshow.theme.inc). =>

I enabled views_slideshow and chose flexslider as the format.

When I enable controls at bottom/top I get this error when I save the view and view the page.

Noticed from this post that highlighted how the code had changes so I've submitted a patch for review.

Thanks

Comments

danny englander’s picture

I can confirm this, I just ran into the same issue as well. It seems like a new issue as I've been using a similar setup across different sites and never had this issue before now until this new dev version.

I unchecked "Hide controls if there is only one slide" even though I do have more than one slide and that seems to make the error go away. The offending line of code in views_slideshow.theme.inc seems to be:

if (empty($vars['settings']['hide_on_single_slide']) || count($vars['rows']) > $vars['view']->style_options['views_slideshow_cycle']['items_per_slide']) { ...

... which seems to make sense in the context of the error. It looks like some changes were made back in June that may have given rise to this error.

http://drupalcode.org/project/views_slideshow.git/commitdiff/54b815f7eda...

madmartigan’s picture

Issue summary: View changes
StatusFileSize
new1.24 KB
zipymonkey’s picture

Thanks for this. There is a similar issue in the _views_slideshow_preprocess_views_slideshow_pager_fields() function at line 241.

+  $items_per_slide = empty($vars['view']->style_options['views_slideshow_cycle']['items_per_slide']) ? 1 : $vars['view']->style_options['views_slideshow_cycle']['items_per_slide'];
+  if (empty($vars['settings']['hide_on_single_slide']) || count($vars['view']->result) > $items_per_slide) {
-  if (empty($vars['settings']['hide_on_single_slide']) || count($vars['view']->result) > $vars['view']->style_options['views_slideshow_cycle']['items_per_slide']) {
r2coder’s picture

Thanks all for the patch. Unfortunately it did not solve the issue in my environment [D7 v34, Visual SlideShow -7.x-3.1]. However, I was able to resolve the problem with the following modification:

  if(isset($var['views_slideshow_cycle'])){
 if (empty($vars['settings']['hide_on_single_slide']) || count($vars['rows']) > $vars['view']->style_options['views_slideshow_cycle']['items_per_slide']) {
     $output = theme(views_theme_functions($vars['settings']['type'], $vars['view'], $vars['view']->display[$vars['view']->current_display]), array('vss_id' => $vars['vss_id']$
  }
}
  return $output;
}
jmsv23’s picture

This work for me to remove the errors.
Notice: Undefined index: views_slideshow_cycle in _views_slideshow_preprocess_views_slideshow_pager_fields() (line 241 of views_slideshow/theme/views_slideshow.theme.inc).
Notice: Undefined index: views_slideshow_cycle in theme_views_slideshow_controls_widget_render() (line 291 of views_slideshow/theme/views_slideshow.theme.inc).

socialnicheguru’s picture

Status: Active » Needs review
interdruper’s picture

Status: Needs review » Reviewed & tested by the community

Patch #5 removed the notice for me.

brad.bulger’s picture

just a workaround note, might be useful for others who can't apply a patch for reasons: contra comment 1, this went away for me when i turned off "hide controls if there is only one slide", and the error returns if i check it again. this is for Views Slideshow 3.1.

redeight’s picture

As far as I can tell, the error only occurs when either control is enabled and the Views Slideshow: Cycle module is not enabled. Seems to me that Views Slideshow is assuming that Views Slideshow: Cycle is always going to be used when this may not be the case. The patch in #5 seems to be a step in the right direction. I feel like we might want to try to find a way to allow other modules to have a hand in this so we aren't so stuck with Views Slideshow: Cycle. Maybe a hook?

madelyncruz’s picture

#5 fixed the error. Thank you.

  • NickWilde committed 709bf58 on 7.x-3.x authored by jmsv23
    Issue #2047867 by jmsv23, madmartigan: Undefined index:...
nickdickinsonwilde’s picture

Status: Reviewed & tested by the community » Fixed

Not quite the fix I'd like to do (fully remove cycle centric code from the api module) but fixes the bug in the mean time so applying. Thanks for the patch!

Status: Fixed » Closed (fixed)

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