Move site visibility settings to a new tab (#46140)
* Move site visibility settings to a new tab * Add changefile(s) from automation for the following project(s): woocommerce * Update tab id to site-visibility and link to it from the homescreen badge * Fix tests * Remove unused code * Lower case tab title * Remove general from the slotfill id * Remove typo * Lint fix * Lint fix --------- Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
parent
674d7a01bf
commit
def3ac920d
|
@ -205,7 +205,7 @@ const SiteVisibilitySlotFill = () => {
|
|||
|
||||
export const registerSiteVisibilitySlotFill = () => {
|
||||
registerPlugin( 'woocommerce-admin-site-visibility-settings-slotfill', {
|
||||
scope: 'woocommerce-settings',
|
||||
scope: 'woocommerce-site-visibility-settings',
|
||||
render: SiteVisibilitySlotFill,
|
||||
} );
|
||||
};
|
||||
|
|
|
@ -50,7 +50,7 @@ export const LaunchYourStoreStatus = ( { comingSoon, storePagesOnly } ) => {
|
|||
<MenuGroup className="woocommerce-lys-status-popover">
|
||||
<MenuItem
|
||||
href={ getAdminLink(
|
||||
'admin.php?page=wc-settings'
|
||||
'admin.php?page=wc-settings&tab=site-visibility'
|
||||
) }
|
||||
>
|
||||
<Icon icon={ cog } size={ 24 } />
|
||||
|
|
|
@ -19,8 +19,8 @@ export const possiblyRenderSettingsSlots = () => {
|
|||
{ id: 'wc_tax_settings_slotfill', scope: 'woocommerce-tax-settings' },
|
||||
{ id: 'wc_settings_slotfill', scope: 'woocommerce-settings' },
|
||||
{
|
||||
id: 'wc_settings_general_site_visibility_slotfill',
|
||||
scope: 'woocommerce-settings',
|
||||
id: 'wc_settings_site_visibility_slotfill',
|
||||
scope: 'woocommerce-site-visibility-settings',
|
||||
},
|
||||
];
|
||||
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: update
|
||||
|
||||
Move site visibility settings to a new tab
|
|
@ -57,6 +57,7 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
|
|||
$settings[] = include __DIR__ . '/settings/class-wc-settings-accounts.php';
|
||||
$settings[] = include __DIR__ . '/settings/class-wc-settings-emails.php';
|
||||
$settings[] = include __DIR__ . '/settings/class-wc-settings-integrations.php';
|
||||
$settings[] = include __DIR__ . '/settings/class-wc-settings-site-visibility.php';
|
||||
$settings[] = include __DIR__ . '/settings/class-wc-settings-advanced.php';
|
||||
|
||||
self::$settings = apply_filters( 'woocommerce_get_settings_pages', $settings );
|
||||
|
|
|
@ -217,11 +217,6 @@ class WC_Settings_General extends WC_Settings_Page {
|
|||
'id' => 'general_options',
|
||||
),
|
||||
|
||||
array(
|
||||
'id' => 'wc_settings_general_site_visibility_slotfill',
|
||||
'type' => 'slotfill_placeholder',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Currency options', 'woocommerce' ),
|
||||
'type' => 'title',
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
/**
|
||||
* WooCommerce site visibility settings
|
||||
*
|
||||
* @package WooCommerce\Admin
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Settings for API.
|
||||
*/
|
||||
if ( class_exists( 'WC_Settings_Site_Visibility', false ) ) {
|
||||
return new WC_Settings_Site_Visibility();
|
||||
}
|
||||
|
||||
/**
|
||||
* WC_Settings_Advanced.
|
||||
*/
|
||||
class WC_Settings_Site_Visibility extends WC_Settings_Page {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->id = 'site-visibility';
|
||||
$this->label = __( 'Site visibility', 'woocommerce' );
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get settings for the default section.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function get_settings_for_default_section() {
|
||||
$settings =
|
||||
array(
|
||||
array(
|
||||
'id' => 'wc_settings_site_visibility_slotfill',
|
||||
'type' => 'slotfill_placeholder',
|
||||
),
|
||||
);
|
||||
|
||||
return $settings;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return new WC_Settings_Site_Visibility();
|
|
@ -12,7 +12,7 @@ class LaunchYourStore {
|
|||
* Constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
add_action( 'woocommerce_update_options_general', array( $this, 'save_site_visibility_options' ) );
|
||||
add_action( 'woocommerce_update_options_site-visibility', array( $this, 'save_site_visibility_options' ) );
|
||||
add_action( 'current_screen', array( $this, 'maybe_create_coming_soon_page' ) );
|
||||
if ( is_admin() ) {
|
||||
add_filter( 'woocommerce_admin_shared_settings', array( $this, 'preload_settings' ) );
|
||||
|
|
|
@ -70,7 +70,6 @@ class WC_Settings_General_Test extends WC_Settings_Unit_Test_Case {
|
|||
'woocommerce_price_decimal_sep' => 'text',
|
||||
'woocommerce_price_num_decimals' => 'number',
|
||||
'pricing_options' => array( 'title', 'sectionend' ),
|
||||
'wc_settings_general_site_visibility_slotfill' => 'slotfill_placeholder',
|
||||
);
|
||||
|
||||
$this->assertEquals( $expected, $settings_ids_and_types );
|
||||
|
|
Loading…
Reference in New Issue