Using context for blocks with block_token causes a warning when saving blocks

Created on 18 December 2024, 4 months ago

Problem/Motivation

Saving blocks using the context module causes warnings:

Warning: Trying to access array offset on value of type null in block_token_form_block_form_alter() (line 178 of /www/dev/ato1-008/web/modules/contrib/block_token/block_token.module)

Warning: Undefined array key "id" in block_token_form_block_form_alter() (line 178 of /www/dev/ato1-008/web/modules/contrib/block_token/block_token.module)

Steps to reproduce

Install context. Create block and go to edit any block using context editor. Check the logs.

Proposed resolution

There was a simular issue in antibot using context but a fix was posted. I think they check for the presence of the key.

https://www.drupal.org/project/antibot/issues/3313508 🐛 Warning: Undefined array key "#id" in antibot_form_alter() RTBC

🐛 Bug report
Status

Active

Version

1.1

Component

Code

Created by

🇬🇧United Kingdom mistergroove

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

Comments & Activities

Production build 0.71.5 2024