Getting warnings on ajax requests

Created on 30 April 2024, 7 months ago
Updated 16 May 2024, 6 months ago

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.

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇬🇧United Kingdom steven jones

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024