Add a safe guard that the variable is set before accessing it (https://github.com/woocommerce/woocommerce-blocks/pull/11424)

This commit is contained in:
Karol Manijak 2023-10-24 12:41:19 +02:00 committed by GitHub
parent ebfa1acc51
commit 8c76a1a712
1 changed files with 1 additions and 1 deletions

View File

@ -61,7 +61,7 @@ class ProductTemplate extends AbstractBlock {
$classnames = '';
if ( isset( $block->context['displayLayout'] ) && isset( $block->context['query'] ) ) {
if ( isset( $block->context['displayLayout']['type'] ) && 'flex' === $block->context['displayLayout']['type'] ) {
if ( $block->context['displayLayout']['shrinkColumns'] ) {
if ( isset( $block->context['displayLayout']['shrinkColumns'] ) && $block->context['displayLayout']['shrinkColumns'] ) {
$classnames = "wc-block-product-template__responsive columns-{$block->context['displayLayout']['columns']}";
} else {
$classnames = "is-flex-container columns-{$block->context['displayLayout']['columns']}";