Prevent possible activation notice due to early initialization of feature settings (#41434)

This commit is contained in:
nigeljamesstevenson 2023-11-15 01:29:37 +00:00 committed by GitHub
commit d8dc064f62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 13 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: fix
Prevent possible notice during plugin activation.

View File

@ -7,8 +7,6 @@ namespace Automattic\WooCommerce\Internal\Features;
use Automattic\WooCommerce\Internal\Admin\Analytics;
use Automattic\WooCommerce\Admin\Features\Navigation\Init;
use Automattic\WooCommerce\Admin\Features\NewProductManagementExperience;
use Automattic\WooCommerce\Internal\DataStores\Orders\CustomOrdersTableController;
use Automattic\WooCommerce\Internal\Traits\AccessiblePrivateMethods;
use Automattic\WooCommerce\Proxies\LegacyProxy;
use Automattic\WooCommerce\Utilities\ArrayUtil;
@ -688,19 +686,21 @@ class FeaturesController {
'id' => empty( $experimental_feature_ids ) ? 'features_options' : 'experimental_features_options',
);
// Allow feature setting properties to be determined dynamically just before being rendered.
$feature_settings = array_map(
function( $feature_setting ) {
foreach ( $feature_setting as $prop => $value ) {
if ( is_callable( $value ) ) {
$feature_setting[ $prop ] = call_user_func( $value );
if ( $this->verify_did_woocommerce_init() ) {
// Allow feature setting properties to be determined dynamically just before being rendered.
$feature_settings = array_map(
function( $feature_setting ) {
foreach ( $feature_setting as $prop => $value ) {
if ( is_callable( $value ) ) {
$feature_setting[ $prop ] = call_user_func( $value );
}
}
}
return $feature_setting;
},
$feature_settings
);
return $feature_setting;
},
$feature_settings
);
}
return $feature_settings;
}