[Settings] Update feature flag usage (#50977)
This commit is contained in:
parent
8b35b0785c
commit
cfcf074886
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: patch
|
||||||
|
Type: tweak
|
||||||
|
Comment: Change to underlying Settings feature usage
|
||||||
|
|
|
@ -27,7 +27,6 @@ class Features {
|
||||||
*/
|
*/
|
||||||
protected static $optional_features = array(
|
protected static $optional_features = array(
|
||||||
'navigation' => array( 'default' => 'no' ),
|
'navigation' => array( 'default' => 'no' ),
|
||||||
'settings' => array( 'default' => 'no' ),
|
|
||||||
'analytics' => array( 'default' => 'yes' ),
|
'analytics' => array( 'default' => 'yes' ),
|
||||||
'remote-inbox-notifications' => array( 'default' => 'yes' ),
|
'remote-inbox-notifications' => array( 'default' => 'yes' ),
|
||||||
);
|
);
|
||||||
|
@ -353,7 +352,6 @@ class Features {
|
||||||
'Automattic\WooCommerce\Internal\Admin\Marketing' => 'Automattic\WooCommerce\Admin\Features\Marketing',
|
'Automattic\WooCommerce\Internal\Admin\Marketing' => 'Automattic\WooCommerce\Admin\Features\Marketing',
|
||||||
'Automattic\WooCommerce\Internal\Admin\MobileAppBanner' => 'Automattic\WooCommerce\Admin\Features\MobileAppBanner',
|
'Automattic\WooCommerce\Internal\Admin\MobileAppBanner' => 'Automattic\WooCommerce\Admin\Features\MobileAppBanner',
|
||||||
'Automattic\WooCommerce\Internal\Admin\RemoteInboxNotifications' => 'Automattic\WooCommerce\Admin\Features\RemoteInboxNotifications',
|
'Automattic\WooCommerce\Internal\Admin\RemoteInboxNotifications' => 'Automattic\WooCommerce\Admin\Features\RemoteInboxNotifications',
|
||||||
'Automattic\WooCommerce\Internal\Admin\SettingsNavigationFeature' => 'Automattic\WooCommerce\Admin\Features\Settings',
|
|
||||||
'Automattic\WooCommerce\Internal\Admin\ShippingLabelBanner' => 'Automattic\WooCommerce\Admin\Features\ShippingLabelBanner',
|
'Automattic\WooCommerce\Internal\Admin\ShippingLabelBanner' => 'Automattic\WooCommerce\Admin\Features\ShippingLabelBanner',
|
||||||
'Automattic\WooCommerce\Internal\Admin\ShippingLabelBannerDisplayRules' => 'Automattic\WooCommerce\Admin\Features\ShippingLabelBannerDisplayRules',
|
'Automattic\WooCommerce\Internal\Admin\ShippingLabelBannerDisplayRules' => 'Automattic\WooCommerce\Admin\Features\ShippingLabelBannerDisplayRules',
|
||||||
'Automattic\WooCommerce\Internal\Admin\WcPayWelcomePage' => 'Automattic\WooCommerce\Admin\Features\WcPayWelcomePage',
|
'Automattic\WooCommerce\Internal\Admin\WcPayWelcomePage' => 'Automattic\WooCommerce\Admin\Features\WcPayWelcomePage',
|
||||||
|
|
|
@ -1,21 +1,16 @@
|
||||||
<?php
|
<?php //phpcs:ignore Generic.PHP.RequireStrictTypes.MissingDeclaration
|
||||||
/**
|
/**
|
||||||
* WooCommerce Settings.
|
* WooCommerce Settings.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Internal\Admin;
|
namespace Automattic\WooCommerce\Admin\Features;
|
||||||
|
|
||||||
use Automattic\WooCommerce\Admin\PageController;
|
use Automattic\WooCommerce\Admin\PageController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains backend logic for the Settings feature.
|
* Contains backend logic for the Settings feature.
|
||||||
*/
|
*/
|
||||||
class SettingsNavigationFeature {
|
class Settings {
|
||||||
/**
|
|
||||||
* Option name used to toggle this feature.
|
|
||||||
*/
|
|
||||||
const TOGGLE_OPTION_NAME = 'woocommerce_settings_enabled';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class instance.
|
* Class instance.
|
||||||
*
|
*
|
||||||
|
@ -41,12 +36,6 @@ class SettingsNavigationFeature {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
add_filter( 'woocommerce_settings_features', array( $this, 'add_feature_toggle' ) );
|
|
||||||
|
|
||||||
if ( 'yes' !== get_option( 'woocommerce_settings_enabled', 'no' ) ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
add_filter( 'woocommerce_admin_shared_settings', array( __CLASS__, 'add_component_settings' ) );
|
add_filter( 'woocommerce_admin_shared_settings', array( __CLASS__, 'add_component_settings' ) );
|
||||||
// Run this after the original WooCommerce settings have been added.
|
// Run this after the original WooCommerce settings have been added.
|
||||||
add_action( 'admin_menu', array( $this, 'register_pages' ), 60 );
|
add_action( 'admin_menu', array( $this, 'register_pages' ), 60 );
|
||||||
|
@ -75,26 +64,6 @@ class SettingsNavigationFeature {
|
||||||
return $settings;
|
return $settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Add the feature toggle to the features settings.
|
|
||||||
*
|
|
||||||
* @param array $features Feature sections.
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public static function add_feature_toggle( $features ) {
|
|
||||||
$features[] = array(
|
|
||||||
'title' => __( 'Settings', 'woocommerce' ),
|
|
||||||
'desc' => __(
|
|
||||||
'Adds the new WooCommerce settings UI.',
|
|
||||||
'woocommerce'
|
|
||||||
),
|
|
||||||
'id' => 'woocommerce_settings_enabled',
|
|
||||||
'type' => 'checkbox',
|
|
||||||
);
|
|
||||||
|
|
||||||
return $features;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers settings pages.
|
* Registers settings pages.
|
||||||
*/
|
*/
|
Loading…
Reference in New Issue