This document describes registering a new block type in WordPress called "WCEU Block". It defines the block's title, icon, and edit and save functions. The edit function returns a <p> element that will be seen in the editor. The save function returns a <p> element that will be saved to the database. It also includes an example of registering a "Section Block" with attributes for block content and alignment.
Let's Build A Gutenberg Block | WordCamp Europe 2018
31. (function (blocks, element) {
blocks.registerBlockType('cgb/block-wceu-block', {
title: __('WCEU Block'),
icon: 'shield',
edit: function (props) {
return element.createElement(
'p',
null,
'You will see me in the editor.'
);
},
save: function (props) {
return element.createElement(
'p',
null,
'I am saved to the database.'
);
}
})
})(
wp.blocks,
wp.element
);
32. const { registerBlockType } = wp.blocks;
registerBlockType( 'cgb/block-wceu-block', {
title: __( ‘WCEU Block' ),
icon: ‘carrot',
edit: function( props ) {
return (
<p>You will see me in the editor.</p>
)
},
save: function( props ) {
return (
<p>I am saved to the database.</p>
)
}
});