simplify conditional

This commit is contained in:
Leif Singer 2023-11-28 13:03:07 +01:00
parent 7f839980ec
commit 2a12fea81d
1 changed files with 5 additions and 1 deletions

View File

@ -10,6 +10,7 @@
use Automattic\WooCommerce\Internal\Traits\AccessiblePrivateMethods;
use Automattic\WooCommerce\Proxies\LegacyProxy;
use Automattic\WooCommerce\Utilities\ArrayUtil;
defined( 'ABSPATH' ) || exit;
@ -276,7 +277,10 @@ All at %6$s
return false;
}
// There was an old value, so this is an update.
if ( ! empty( $value ) && ! empty( $old_value ) && is_array( $value ) && is_array( $old_value ) && isset( $value['enabled'] ) && isset( $old_value['enabled'] ) && 'yes' === $value['enabled'] && 'yes' !== $old_value['enabled'] && isset( $value['title'] ) ) {
if (
ArrayUtil::get_value_or_default( $value, 'enabled' ) === 'yes' &&
ArrayUtil::get_value_or_default( $old_value, 'enabled' ) !== 'yes' &&
isset( $value['title'] ) ) {
return true;
}
return false;