This commit is contained in:
paul sealock 2024-05-29 22:39:02 +12:00
parent 214d3fb839
commit 868b3c149c
5 changed files with 21 additions and 4 deletions

View File

@ -14,7 +14,10 @@ export const Content = ( { data } ) => {
switch ( setting.type ) {
case 'title':
return (
<div className="woocommerce-settings-element">
<div
key={ setting.id }
className="woocommerce-settings-element"
>
<h3>{ setting.title }</h3>
</div>
);

View File

@ -62,6 +62,10 @@
justify-content: space-between;
margin: 16px 0px;
&:first-of-type {
margin: 0;
}
h4 {
margin: 0;
width: 200px;

View File

@ -26,7 +26,7 @@
"remote-free-extensions": true,
"payment-gateway-suggestions": true,
"printful": false,
"settings": true,
"settings": false,
"shipping-label-banner": true,
"subscriptions": true,
"store-alerts": true,

View File

@ -99,7 +99,9 @@ if ( ! class_exists( 'WC_Settings_Page', false ) ) :
$section_settings_data = array();
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;
}
$sections_data[ $section_id ] = array(

View File

@ -54,7 +54,15 @@ class 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();
$pages = array();