I am getting PHP Notice: Undefined variable: output in views_slideshow_help() (line 25.

Return statement needs to be inside switch case to avoid returning undefined variable $output.

function views_slideshow_help($route_name, RouteMatchInterface $route_match) {
  switch ($route_name) {
    // Main module help for the gss module.
    case 'help.page.views_slideshow':
      $output .= '<h3>' . t('About') . '</h3>';
      $output .= '<p>' . t('Views Slideshow can be used to create a slideshow of any content (not just images) that can appear in a View. Powered by jQuery, it is heavily customizable: you may choose slideshow settings for each View you create.') . '</p>';
      $output .= '<h3>' . t('More Information') . '</h3>';
      $output .= '<p>' . t('For more information about this module visite the <a href="@link">Views Slideshow</a> module page.', array('@link' => 'https://www.drupal.org/project/views_slideshow')) . '</p>';
      return $output;
  }
}
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tbrix created an issue. See original summary.

tbrix’s picture

NickDickinsonWilde’s picture

Status: Active » Needs review
NickDickinsonWilde’s picture

Assigned: Unassigned » NickDickinsonWilde
Status: Needs review » Needs work
Issue tags: +Needs tests

Thanks for the patch! As this is for 8.x-4.x branch it requires tests for any bug fixes; I'll make a test.

keithm’s picture

Fixed #2 to avoid concatenating to undefined variable on line 17.

NickDickinsonWilde’s picture

Status: Needs work » Needs review
NickDickinsonWilde’s picture

Issue tags: -Needs tests

nah further look and this doesn't need a test.
Applied, thanks both of you!

NickDickinsonWilde’s picture

Assigned: NickDickinsonWilde » Unassigned
Status: Needs review » Fixed

  • NickWilde committed 8de00c4 on 8.x-4.x authored by keithm
    Issue #2845199 by tbrix, keithm: Undefined variable: output in...
itapplication’s picture

I also get this error for Version: 8.x-4.3

Notice: Undefined variable: output in views_slideshow_help() (line 23 of modules/views_slideshow/views_slideshow.module).
views_slideshow_help('system.admin_content', Object)
call_user_func_array('views_slideshow_help', Array) (Line: 391)
Drupal\Core\Extension\ModuleHandler->invoke('views_slideshow', 'help', Array) (Line: 99)

Any idea how to fix this? Please help.

itapplication’s picture

Status: Fixed » Active
NickDickinsonWilde’s picture

Status: Active » Fixed

Update to the latest dev release or wait for the next stable release. (to be clear, the dev release is stable rn)

brandonratz’s picture

Confirming fix works in 8.x-4.x-dev

quesix562’s picture

I received this error after installing version 8.x-4.3 and clearing the caches.

Notice: Undefined variable: output in views_slideshow_help() (line 23 of modules/contrib/views_slideshow/views_slideshow.module).
views_slideshow_help('system.status', Object)
call_user_func_array('views_slideshow_help', Array) (Line: 391)

NickDickinsonWilde’s picture

Status: Fixed » Closed (fixed)

I'll release a new stable version in the next few days - it is fixed in 8.x-4.x-dev.