From 2c8315c77633d4e0b12f7992c45521890143999e Mon Sep 17 00:00:00 2001 From: Jb Audras Date: Thu, 27 Jul 2023 09:16:53 +0000 Subject: [PATCH] Editor: Prevent PHP warning when accessing icon by area. This changeset prevents an attempt to access an array via a key that doesn't exist. See https://github.com/WordPress/gutenberg/pull/52961. Props aaronrobertshaw, glendaviesnz, mukesh27. Fixes #58920. git-svn-id: https://develop.svn.wordpress.org/trunk@56316 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/blocks/template-part.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/blocks/template-part.php b/src/wp-includes/blocks/template-part.php index 1066aa0141..86a1feefd6 100644 --- a/src/wp-includes/blocks/template-part.php +++ b/src/wp-includes/blocks/template-part.php @@ -250,7 +250,7 @@ function build_template_part_block_instance_variations() { 'area' => $template_part->area, ), 'scope' => array( 'inserter' ), - 'icon' => $icon_by_area[ $template_part->area ], + 'icon' => isset( $icon_by_area[ $template_part->area ] ) ? $icon_by_area[ $template_part->area ] : null, 'example' => array( 'attributes' => array( 'slug' => $template_part->slug,