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.

Comments

Nels created an issue. See original summary.

nels’s picture

StatusFileSize
new876 bytes
brian.seek’s picture

Status: Active » Reviewed & tested by the community

I have tested this patch and it seems to fix the issue.

nels’s picture

StatusFileSize
new744 bytes

I think this new patch applies better. My inexperience in patching is showing.

Irisibk’s picture

StatusFileSize
new721 bytes

This patch is for the 8.x-2.x version.

brian.seek’s picture

Status: Reviewed & tested by the community » Needs review
richgerdes’s picture

jrglasgow’s picture

Status: Needs review » Closed (outdated)

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.