BlockTemplatesController: Check that $attributes['theme'] value isset before operating on it (https://github.com/woocommerce/woocommerce-blocks/pull/10879)

This commit is contained in:
Tom Cafferkey 2023-09-13 14:58:16 +02:00 committed by GitHub
parent c28319fc3c
commit fd83e0a4cb
1 changed files with 1 additions and 1 deletions

View File

@ -158,7 +158,7 @@ class BlockTemplatesController {
* @return string The render. * @return string The render.
*/ */
public function render_woocommerce_template_part( $attributes ) { public function render_woocommerce_template_part( $attributes ) {
if ( 'woocommerce/woocommerce' === $attributes['theme'] ) { if ( isset( $attributes['theme'] ) && 'woocommerce/woocommerce' === $attributes['theme'] ) {
$template_part = BlockTemplateUtils::get_block_template( $attributes['theme'] . '//' . $attributes['slug'], 'wp_template_part' ); $template_part = BlockTemplateUtils::get_block_template( $attributes['theme'] . '//' . $attributes['slug'], 'wp_template_part' );
if ( $template_part && ! empty( $template_part->content ) ) { if ( $template_part && ! empty( $template_part->content ) ) {