From 85fe960cb8e67efe4aff9f274d401dd25d9a42d2 Mon Sep 17 00:00:00 2001
From: Brian Coords <bacoords@gmail.com>
Date: Tue, 9 May 2023 08:53:05 -0700
Subject: [PATCH] adds better conditional for missing attributes

---
 build/render.php | 5 ++---
 src/render.php   | 5 ++---
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/build/render.php b/build/render.php
index b580189..25d76fa 100644
--- a/build/render.php
+++ b/build/render.php
@@ -8,15 +8,14 @@
  *
  * @package wpdev
  */
-
 ?>
 
 <div <?php echo get_block_wrapper_attributes(); ?> tabindex="0">
 	<?php
-	if ( $attributes['foregroundImage'] ) {
+	if ( isset( $attributes['foregroundImage'] ) && $attributes['foregroundImage'] ) {
 		echo wp_get_attachment_image( $attributes['foregroundImage'], 'full' );
 	}
-	if ( $attributes['backgroundImage'] ) {
+	if ( isset( $attributes['backgroundImage'] ) && $attributes['backgroundImage'] ) {
 		echo wp_get_attachment_image( $attributes['backgroundImage'], 'full' );
 	}
 	?>
diff --git a/src/render.php b/src/render.php
index b580189..25d76fa 100644
--- a/src/render.php
+++ b/src/render.php
@@ -8,15 +8,14 @@
  *
  * @package wpdev
  */
-
 ?>
 
 <div <?php echo get_block_wrapper_attributes(); ?> tabindex="0">
 	<?php
-	if ( $attributes['foregroundImage'] ) {
+	if ( isset( $attributes['foregroundImage'] ) && $attributes['foregroundImage'] ) {
 		echo wp_get_attachment_image( $attributes['foregroundImage'], 'full' );
 	}
-	if ( $attributes['backgroundImage'] ) {
+	if ( isset( $attributes['backgroundImage'] ) && $attributes['backgroundImage'] ) {
 		echo wp_get_attachment_image( $attributes['backgroundImage'], 'full' );
 	}
 	?>