uswds_preprocess_block breaks block_field

Created on 19 August 2019, over 5 years ago
Updated 22 July 2024, 4 months ago

We're using block_field β†’ to place a block in a Paragraph (for some complicated layout), but the usdws base theme breaks the page ("The website encountered an unexpected error. Please try again later.")

In the error logs, we have "Notice: Undefined index: #id in uswds_preprocess_block() (line 21" followed by "Warning: assert(): Cannot load a NULL ID"

Lines 21 & 22 of block.preprocess.inc

if (!in_array($variables['plugin_id'], $no_grid)) {
      $block = \Drupal\block\Entity\Block::load($variables['elements']['#id']);

Line 21 should also be checking for the existence of $variables['elements']['#id'] before attempting to load that as a block.

πŸ› Bug report
Status

Needs review

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States Nels

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024