Getting warnings on ajax requests

Created on 30 April 2024, about 2 months ago
Updated 16 May 2024, about 1 month 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.69.0 2024