block.js
33 lines
| 1 | /** |
| 2 | * WordPress dependencies |
| 3 | */ |
| 4 | const { Fragment } = wp.element; |
| 5 | const ServerSideRender = wp.serverSideRender; |
| 6 | const { withSelect } = wp.data; |
| 7 | |
| 8 | /** |
| 9 | * Internal dependencies |
| 10 | */ |
| 11 | import Inspector from './inspector'; |
| 12 | |
| 13 | /** |
| 14 | * Render Block UI For Editor |
| 15 | */ |
| 16 | |
| 17 | const GiveDonationFormGrid = ( props ) => { |
| 18 | const { attributes } = props; |
| 19 | |
| 20 | return ( |
| 21 | <Fragment> |
| 22 | <Inspector { ... { ...props } } /> |
| 23 | <ServerSideRender block="give/donation-form-grid" attributes={ attributes } /> |
| 24 | </Fragment> |
| 25 | ); |
| 26 | }; |
| 27 | |
| 28 | export default withSelect( ( select ) => { |
| 29 | return { |
| 30 | forms: select( 'core' ).getEntityRecords( 'postType', 'give_forms' ), |
| 31 | }; |
| 32 | } )( GiveDonationFormGrid ); |
| 33 |