From 214d3fb839f0a3b20f31b75ee4d37afe30aee877 Mon Sep 17 00:00:00 2001 From: paul sealock Date: Wed, 29 May 2024 17:24:19 +1200 Subject: [PATCH] content layout --- .../client/settings/components/checkbox.js | 6 +++--- .../woocommerce-admin/client/settings/content.js | 8 +++++++- .../woocommerce-admin/client/settings/style.scss | 15 +++++++++++++++ .../admin/settings/class-wc-settings-page.php | 9 ++++++++- 4 files changed, 33 insertions(+), 5 deletions(-) diff --git a/plugins/woocommerce-admin/client/settings/components/checkbox.js b/plugins/woocommerce-admin/client/settings/components/checkbox.js index 7ada257a9f6..955f7ae2f9e 100644 --- a/plugins/woocommerce-admin/client/settings/components/checkbox.js +++ b/plugins/woocommerce-admin/client/settings/components/checkbox.js @@ -5,12 +5,12 @@ import { CheckboxControl } from '@wordpress/components'; export const SettingsCheckbox = ( { setting } ) => { return ( -
-

{ setting.title }

+
+

{ setting.title }

console.log( 'change' ) } - selected={ true } + checked={ 'yes' === setting.value } />
); diff --git a/plugins/woocommerce-admin/client/settings/content.js b/plugins/woocommerce-admin/client/settings/content.js index 64faa174611..913028601d1 100644 --- a/plugins/woocommerce-admin/client/settings/content.js +++ b/plugins/woocommerce-admin/client/settings/content.js @@ -6,12 +6,18 @@ import { SettingsCheckbox } from './components'; export const Content = ( { data } ) => { const { settings } = data; + console.log( settings ); + return (
{ settings.map( ( setting ) => { switch ( setting.type ) { case 'title': - return null; + return ( +
+

{ setting.title }

+
+ ); case 'checkbox': return ( get_sections(); $sections_data = array(); foreach ( $sections as $section_id => $section_label ) { + $section_settings = $this->get_settings_for_section( $section_id ); + $section_settings_data = array(); + + foreach( $section_settings as $section_setting ) { + $section_setting['value'] = get_option( $section_setting['id'], $section_setting['default'] ); + $section_settings_data[] = $section_setting; + } $sections_data[ $section_id ] = array( 'label' => html_entity_decode( $section_label ), - 'settings' => $this->get_settings_for_section( $section_id ), + 'settings' => $section_settings_data, ); } $pages[ $this->id ] = array(