Server IP : 104.21.14.103 / Your IP : 18.226.186.172 Web Server : LiteSpeed System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : giankuin ( 1871) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/thread-self/root/home/giankuin/sieuthiweb.com.vn/wp-content/plugins/woocommerce/packages/woocommerce-blocks/assets/js/components/page-selector/ |
Upload File : |
/** * External dependencies */ import { __ } from '@wordpress/i18n'; import { PanelBody, SelectControl } from '@wordpress/components'; import { useSelect } from '@wordpress/data'; /** * Internal dependencies */ import { formatTitle } from '../utils'; const PageSelector = ( { setPageId, pageId, labels } ) => { const pages = useSelect( ( select ) => { return select( 'core' ).getEntityRecords( 'postType', 'page', { status: 'publish', orderby: 'title', order: 'asc', per_page: 100, } ); }, [] ) || null; if ( pages ) { return ( <PanelBody title={ labels.title }> <SelectControl label={ __( 'Link to', 'woocommerce' ) } value={ pageId } options={ [ { label: labels.default, value: 0, }, ...pages.map( ( page ) => { return { label: formatTitle( page, pages ), value: parseInt( page.id, 10 ), }; } ), ] } onChange={ ( value ) => setPageId( parseInt( value, 10 ) ) } /> </PanelBody> ); } return null; }; export default PageSelector;