Problem/Motivation

I'm seeing the following warning:

Warning: Undefined array key "header" in Drupal\views_show_more\EventSubscriber\ShowMoreEventSubscriber->onResponse() (line 102 of /app/webroot/modules/contrib/views_show_more/src/EventSubscriber/ShowMoreEventSubscriber.php)

And then also the same for the footer key a few lines below.

So it's this line:
https://git.drupalcode.org/project/views_show_more/-/blob/2.x/src/EventS...

$attachments['drupalSettings']['header'] .= $this->renderer->renderPlain($header_render);

This needs to check to see if $attachments['drupalSettings']['header'] exists before using it.

Steps to reproduce

Have a view with attachments, and use the views load more module.

Proposed resolution

Add some checks for these array keys before using them.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Steven Jones created an issue. See original summary.

akhil_01’s picture

Assigned: Unassigned » akhil_01

steven jones’s picture

Assigned: akhil_01 » Unassigned
Status: Active » Needs review

ivnish’s picture

Status: Needs review » Fixed

Thanks! Fixed

Status: Fixed » Closed (fixed)

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