Warning: Undefined array key "context_visibility" when configuring section

Created on 17 May 2024, 6 months ago

Problem/Motivation

Seeing the following warning in watchdog log:

Warning: Undefined array key "context_visibility" in layout_builder_context_form_alter() (line 33 of /app/web/modules/contrib/layout_builder_context/layout_builder_context.module)

Steps to reproduce

Configuring a layout builder section that has not previously used Layout Builder Context and check PHP notices in the log.

Proposed resolution

Relevant line 33:

        $contexts = is_array($configuration["context_visibility"]) ? $configuration["context_visibility"] : [];

Just use the null coalescing operator, It's cleaner and does the trick.

πŸ› Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States amanire

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

Comments & Activities

Production build 0.71.5 2024