diff --git a/inc/acf-gutenberg.php b/inc/acf-gutenberg.php index 7d4a4dc69..a0099ea7a 100644 --- a/inc/acf-gutenberg.php +++ b/inc/acf-gutenberg.php @@ -360,7 +360,17 @@ function _s_get_block_expired_class() { return; } - $other_options = get_sub_field( 'other_options' ) ? get_sub_field( 'other_options' ) : get_field( 'other_options' )['other_options']; + $other_options = array(); + + if ( get_sub_field( 'other_options' ) ) { + $other_options = get_sub_field( 'other_options' ); + } elseif ( isset( get_field( 'other_options' )['other_options'] ) ) { + $other_options = get_field( 'other_options' )['other_options']; + } + + if ( empty( $other_options ) ) { + return; + } if ( _s_has_block_expired( array( diff --git a/inc/acf.php b/inc/acf.php index a0b92f5f5..5b765a198 100644 --- a/inc/acf.php +++ b/inc/acf.php @@ -21,7 +21,13 @@ function _s_display_block_options( $args = array() ) { // Get block background options. - $background_options = get_sub_field( 'background_options' ) ? get_sub_field( 'background_options' ) : get_field( 'background_options' )['background_options']; + $background_options = array(); + + if ( get_sub_field( 'background_options' ) ) { + $background_options = get_sub_field( 'background_options' ); + } elseif ( get_field( 'background_options' ) && isset( get_field( 'background_options' )['background_options'] ) ) { + $background_options = get_field( 'background_options' )['background_options']; + } // Get block other options. $other_options = array(); @@ -29,7 +35,7 @@ function _s_display_block_options( $args = array() ) { // Set our Other Options if we have them. Some blocks may not. if ( get_sub_field( 'other_options' ) ) { $other_options = get_sub_field( 'other_options' ); - } elseif ( get_field( 'other_options' ) ) { + } elseif ( get_field( 'other_options' ) && isset( get_field( 'other_options' )['other_options'] ) ) { $other_options = get_field( 'other_options' )['other_options']; } @@ -41,7 +47,7 @@ function _s_display_block_options( $args = array() ) { // Set our Display Options if we have them. Some blocks may not. if ( get_sub_field( 'display_options' ) ) { $display_options = get_sub_field( 'display_options' ); - } elseif ( get_field( 'display_options' ) ) { + } elseif ( get_field( 'display_options' ) && isset( get_field( 'display_options' )['display_options'] ) ) { $display_options = get_field( 'display_options' )['display_options']; } @@ -50,7 +56,7 @@ function _s_display_block_options( $args = array() ) { // Setup defaults. $defaults = array( - 'background_type' => $background_options['background_type']['value'], + 'background_type' => ! empty( $background_options ) ? $background_options['background_type']['value'] : 'none', 'container' => 'section', 'class' => 'content-block', 'font_color' => $display_options['font_color'],