Preprocess block hook errors out if $block is null

Created on 6 February 2023, over 1 year ago
Updated 23 April 2023, about 1 year ago

Problem/Motivation

I encountered a situation where the preprocess block hook tries to load an element's block and no block is associated with the element.

This causes the error:

Got error 'PHP message: Error: Call to a member function getRegion() on null in /var/www/html/web/themes/contrib/bulma/bulma.theme on line 210 #0 [internal function]: bulma_preprocess_block(Array, 'block', Array)\

Steps to reproduce

I'm not sure what other scenarios would cause this problem but I encountered it when trying to render a view with a faceted search. There is an attempt to render the faceted search fields as a block but they are not blocks so trying to load their block fails.

Proposed resolution

Check that a block is loaded before trying to get its region

Remaining tasks

Apply the included patch

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

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

Comments & Activities

Production build 0.69.0 2024