fix filtering
This commit is contained in:
parent
4242eb3ba6
commit
a9bc571447
|
@ -8,7 +8,6 @@ import { useSettingsLocation } from '../../routes';
|
|||
*/
|
||||
import { getNewPath } from '@woocommerce/navigation';
|
||||
import { Link } from '@woocommerce/components';
|
||||
import { addFilter } from '@wordpress/hooks';
|
||||
|
||||
export const MyExample = () => {
|
||||
const { section } = useSettingsLocation();
|
||||
|
@ -32,20 +31,3 @@ export const MyExampleEdit = () => {
|
|||
</>
|
||||
);
|
||||
};
|
||||
|
||||
addFilter( 'woocommerce_admin_settings_pages', 'woocommerce', ( pages ) => {
|
||||
return [
|
||||
...pages,
|
||||
{
|
||||
page: 'my-example',
|
||||
areas: {
|
||||
content: <MyExample />,
|
||||
edit: <MyExampleEdit />,
|
||||
},
|
||||
widths: {
|
||||
content: undefined,
|
||||
edit: 380,
|
||||
},
|
||||
},
|
||||
];
|
||||
} );
|
||||
|
|
|
@ -2,12 +2,13 @@
|
|||
* External dependencies
|
||||
*/
|
||||
import { getQuery } from '@woocommerce/navigation';
|
||||
import { applyFilters } from '@wordpress/hooks';
|
||||
import { applyFilters, addFilter } from '@wordpress/hooks';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
import { Content } from './content';
|
||||
import { MyExample, MyExampleEdit } from './pages/my-example';
|
||||
|
||||
const NotFound = () => {
|
||||
return <h1>Not Found</h1>;
|
||||
|
@ -60,6 +61,23 @@ export const getRoute = () => {
|
|||
};
|
||||
}
|
||||
|
||||
addFilter( 'woocommerce_admin_settings_pages', 'woocommerce', ( pages ) => {
|
||||
return [
|
||||
...pages,
|
||||
{
|
||||
page: 'my-example',
|
||||
areas: {
|
||||
content: <MyExample />,
|
||||
edit: <MyExampleEdit />,
|
||||
},
|
||||
widths: {
|
||||
content: undefined,
|
||||
edit: 380,
|
||||
},
|
||||
},
|
||||
];
|
||||
} );
|
||||
|
||||
const routes = applyFilters( 'woocommerce_admin_settings_pages', [] );
|
||||
|
||||
const pageRoute = routes.find( ( route ) => route.page === page );
|
||||
|
|
|
@ -9,7 +9,7 @@ export const SectionNav = ( { data, section, children } ) => {
|
|||
const sectionKeys = Object.keys( sections );
|
||||
const selectedSection = section || sectionKeys[ 0 ];
|
||||
const onSelect = ( tabName ) => {
|
||||
const url = getNewPath( { section: tabName } );
|
||||
const url = getNewPath( { section: tabName, quickEdit: 'false' } );
|
||||
navigateTo( { url } );
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue