cleanup
This commit is contained in:
parent
214d3fb839
commit
868b3c149c
|
@ -14,7 +14,10 @@ export const Content = ( { data } ) => {
|
||||||
switch ( setting.type ) {
|
switch ( setting.type ) {
|
||||||
case 'title':
|
case 'title':
|
||||||
return (
|
return (
|
||||||
<div className="woocommerce-settings-element">
|
<div
|
||||||
|
key={ setting.id }
|
||||||
|
className="woocommerce-settings-element"
|
||||||
|
>
|
||||||
<h3>{ setting.title }</h3>
|
<h3>{ setting.title }</h3>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
@ -62,6 +62,10 @@
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
margin: 16px 0px;
|
margin: 16px 0px;
|
||||||
|
|
||||||
|
&:first-of-type {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
h4 {
|
h4 {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
width: 200px;
|
width: 200px;
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
"remote-free-extensions": true,
|
"remote-free-extensions": true,
|
||||||
"payment-gateway-suggestions": true,
|
"payment-gateway-suggestions": true,
|
||||||
"printful": false,
|
"printful": false,
|
||||||
"settings": true,
|
"settings": false,
|
||||||
"shipping-label-banner": true,
|
"shipping-label-banner": true,
|
||||||
"subscriptions": true,
|
"subscriptions": true,
|
||||||
"store-alerts": true,
|
"store-alerts": true,
|
||||||
|
|
|
@ -99,7 +99,9 @@ if ( ! class_exists( 'WC_Settings_Page', false ) ) :
|
||||||
$section_settings_data = array();
|
$section_settings_data = array();
|
||||||
|
|
||||||
foreach( $section_settings as $section_setting ) {
|
foreach( $section_settings as $section_setting ) {
|
||||||
$section_setting['value'] = get_option( $section_setting['id'], $section_setting['default'] );
|
if ( isset( $section_setting['id'] ) ) {
|
||||||
|
$section_setting['value'] = isset( $section_setting['default'] ) ? get_option( $section_setting['id'], $section_setting['default'] ) : get_option( $section_setting['id'] );
|
||||||
|
}
|
||||||
$section_settings_data[] = $section_setting;
|
$section_settings_data[] = $section_setting;
|
||||||
}
|
}
|
||||||
$sections_data[ $section_id ] = array(
|
$sections_data[ $section_id ] = array(
|
||||||
|
|
|
@ -54,7 +54,15 @@ class Settings {
|
||||||
return $settings;
|
return $settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: change so its only being added on Settings page, otherwise bail.
|
// phpcs:disable WordPress.Security.NonceVerification.Recommended
|
||||||
|
$page = sanitize_text_field( wp_unslash( $_GET['page'] ) );
|
||||||
|
$path = sanitize_text_field( wp_unslash( $_GET['path'] ) );
|
||||||
|
|
||||||
|
// Only add data when we are on the settings page.
|
||||||
|
if ( 'wc-admin' !== $page && 0 !== strpos( $path, '/settings' ) ) {
|
||||||
|
return $settings;
|
||||||
|
}
|
||||||
|
// phpcs:enable
|
||||||
|
|
||||||
$setting_pages = \WC_Admin_Settings::get_settings_pages();
|
$setting_pages = \WC_Admin_Settings::get_settings_pages();
|
||||||
$pages = array();
|
$pages = array();
|
||||||
|
|
Loading…
Reference in New Issue