$value ) { if ( in_array( $key, $required ) && ( empty( $value ) || is_wp_error( $value ) ) ) { $empty_fields[] = $key; } } // There is empty fields, warn and bail if ( $empty_fields ) { $message = $message . ' (' . implode( ', ', $empty_fields ) . ')'; // Log QM message always \do_action( "qm/{$log_level}", $message ); // Show message when editing in dashboard // This is safe unescaped if ( is_admin() ) { echo $message; // phpcs:ignore } // Empty required fields, bail the show return true; } // All required fields had data, allow show return false; } // end check_acf_block_fields /** * Check if block can be cached * * @param string $block_slug The block slug * @return bool True if block can be cached, false if not */ function acf_block_maybe_enable_cache( string $block_slug ) { $enable_cache = true; // Default value // This function shouldn't really be running if we don't have these, but check to be safe if ( empty( THEME_SETTINGS ) || empty( THEME_SETTINGS['acf_blocks'] ) || empty( THEME_SETTINGS['acf_blocks'][ $block_slug ] ) ) { \do_action( 'qm/debug', "Block {$block_slug} settings couldn't be found in theme settings" ); return apply_filters( 'air_acf_block_maybe_enable_cache', $enable_cache, $block_slug ); } else if ( empty( THEME_SETTINGS['acf_blocks'][ $block_slug ]['prevent_cache'] ) ) { return apply_filters( 'air_acf_block_maybe_enable_cache', $enable_cache, $block_slug ); } else { // Check from block settings if we should prevent cache $enable_cache = THEME_SETTINGS['acf_blocks'][ $block_slug ]['prevent_cache'] ? false : true; } // Check from block settings if we should prevent cache $enable_cache = THEME_SETTINGS['acf_blocks'][ $block_slug ]['prevent_cache'] ? false : true; return apply_filters( 'air_acf_block_maybe_enable_cache', $enable_cache, $block_slug ); }