Add generic approach to adding features without UI
In our case for the Cart & Checkout feature, we don't want to show the UI in the "Features" tab in Woo Settings. Creating a flag for this purpose will make it easier for future features to unsubscribe from showing a UI if required
This commit is contained in:
parent
390efe8bdd
commit
b5b0c28ed0
|
@ -94,21 +94,25 @@ class FeaturesController {
|
||||||
'description' => __( 'Enables WooCommerce Analytics', 'woocommerce' ),
|
'description' => __( 'Enables WooCommerce Analytics', 'woocommerce' ),
|
||||||
'is_experimental' => false,
|
'is_experimental' => false,
|
||||||
'enabled_by_default' => true,
|
'enabled_by_default' => true,
|
||||||
|
'disable_ui' => false,
|
||||||
),
|
),
|
||||||
'new_navigation' => array(
|
'new_navigation' => array(
|
||||||
'name' => __( 'Navigation', 'woocommerce' ),
|
'name' => __( 'Navigation', 'woocommerce' ),
|
||||||
'description' => __( 'Adds the new WooCommerce navigation experience to the dashboard', 'woocommerce' ),
|
'description' => __( 'Adds the new WooCommerce navigation experience to the dashboard', 'woocommerce' ),
|
||||||
'is_experimental' => false,
|
'is_experimental' => false,
|
||||||
|
'disable_ui' => false,
|
||||||
),
|
),
|
||||||
'custom_order_tables' => array(
|
'custom_order_tables' => array(
|
||||||
'name' => __( 'High-Performance order storage (COT)', 'woocommerce' ),
|
'name' => __( 'High-Performance order storage (COT)', 'woocommerce' ),
|
||||||
'description' => __( 'Enable the high performance order storage feature.', 'woocommerce' ),
|
'description' => __( 'Enable the high performance order storage feature.', 'woocommerce' ),
|
||||||
'is_experimental' => true,
|
'is_experimental' => true,
|
||||||
|
'disable_ui' => false,
|
||||||
),
|
),
|
||||||
'cart_checkout_blocks' => array(
|
'cart_checkout_blocks' => array(
|
||||||
'name' => __( 'Cart & Checkout Blocks', 'woocommerce' ),
|
'name' => __( 'Cart & Checkout Blocks', 'woocommerce' ),
|
||||||
'description' => __( 'Optimize for faster checkout', 'woocommerce' ),
|
'description' => __( 'Optimize for faster checkout', 'woocommerce' ),
|
||||||
'is_experimental' => false,
|
'is_experimental' => false,
|
||||||
|
'disable_ui' => true,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -540,7 +544,13 @@ class FeaturesController {
|
||||||
return $features[ $feature_id ]['is_experimental'];
|
return $features[ $feature_id ]['is_experimental'];
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
$mature_feature_ids = array_diff( $feature_ids, $experimental_feature_ids, array( 'cart_checkout_blocks' ) );
|
$disabled_ui_feature_ids = array_filter(
|
||||||
|
$feature_ids,
|
||||||
|
function( $feature_id ) use ( $features ) {
|
||||||
|
return $features[ $feature_id ]['disable_ui'];
|
||||||
|
}
|
||||||
|
);
|
||||||
|
$mature_feature_ids = array_diff( $feature_ids, $experimental_feature_ids, $disabled_ui_feature_ids );
|
||||||
$feature_ids = array_merge( $mature_feature_ids, array( 'mature_features_end' ), $experimental_feature_ids );
|
$feature_ids = array_merge( $mature_feature_ids, array( 'mature_features_end' ), $experimental_feature_ids );
|
||||||
|
|
||||||
foreach ( $feature_ids as $id ) {
|
foreach ( $feature_ids as $id ) {
|
||||||
|
|
Loading…
Reference in New Issue