get output() working

This commit is contained in:
paul sealock 2024-06-06 14:44:29 +12:00
parent 7b0a5151fc
commit e13fc91235
3 changed files with 31 additions and 2 deletions

View File

@ -1,7 +1,9 @@
/**
* External dependencies
*/
import { getQuery } from '@woocommerce/navigation';
import { getQuery, getNewPath } from '@woocommerce/navigation';
import { Button } from '@wordpress/components';
import { Icon, chevronLeft } from '@wordpress/icons';
import { useEffect } from '@wordpress/element';
/**
@ -49,6 +51,10 @@ const Settings = ( { params } ) => {
<>
<div className="woocommerce-settings-layout">
<div className="woocommerce-settings-layout-navigation">
<Button href={ getNewPath( {}, '/', {} ) }>
<Icon icon={ chevronLeft } />
Settings
</Button>
<Tabs data={ settingsData } page={ params.page } />
</div>
<div className="woocommerce-settings-layout-content">

View File

@ -25,6 +25,11 @@
.woocommerce-settings-layout-navigation {
min-width: 300px;
color: white;
.components-button {
font-size: 16px;
color: white;
}
}
.woocommerce-settings-layout-content {
@ -79,11 +84,12 @@
h4 {
margin: 0;
width: 200px;
min-width: 200px;
}
.components-base-control {
flex: 1;
overflow: auto;
}
.components-input-control__container {

View File

@ -152,6 +152,23 @@ if ( ! class_exists( 'WC_Settings_Page', false ) ) :
$section_settings_data[] = $section_setting;
}
if ( count( $section_settings ) === 0 ) {
global $current_section;
$saved_current_section = $current_section;
$current_section = $section_id;
ob_start();
do_action( 'woocommerce_settings_' . $this->id );
$html = ob_get_contents();
$section_settings_data[] = array(
'type' => 'custom',
'content' => trim( $html ),
);
ob_end_clean();
$current_section = $saved_current_section;
}
$sections_data[ $section_id ] = array(
'label' => html_entity_decode( $section_label ),
'settings' => $section_settings_data,