Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- register_block_type( 'some/block', array(
- 'render_callback' => 'render_my_block',
- 'attributes' => array(
- 'stuff' => array(
- )
- )
- ));
- function render_my_block( $attributes ) {
- // $attributes['stuff']
- return '<h1>Hello frontend</h1>';
- }
- registerBlockType( 'some/block', {
- title: 'Some block',
- attributes: {
- stuff : {
- }
- },
- edit( { className, attributes, setAttributes } ) {
- return (
- <Fragment>
- <SomeInput />
- <SomeOtherInput />
- <Preview>
- // I need to get contents of PHP function render_my_block here,
- // based on current attributes.stuff
- </Preview>
- </Fragment>
- );
- },
- save( { attributes } ) {
- return null; // server side
- }
- } );
Add Comment
Please, Sign In to add comment