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.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

amanire created an issue. See original summary.

amanire’s picture

Title: Warning: Undefined array key "context_visibility" in layout_builder_context_form_alter() » Warning: Undefined array key "context_visibility" when configuring section
amanire’s picture

Issue summary: View changes
amanire’s picture

Issue summary: View changes
amanire’s picture

Status: Active » Needs review
amanire’s picture

Issue summary: View changes
amanire’s picture

Issue summary: View changes

kevinquillen made their first commit to this issue’s fork.

darkodev’s picture

Thanks for fixing. Works for us.

darkodev’s picture

Status: Needs review » Reviewed & tested by the community

kevinquillen’s picture

Status: Reviewed & tested by the community » Fixed

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

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

Maintainers, please credit people who helped resolve this issue.

  • kevinquillen committed 893aeef0 on 1.0.x
    [#3447887] fix: Warning: Undefined array key context_visibility when...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.