This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
( function( blocks, components, i18n, element ) { | |
var el = element.createElement; | |
blocks.registerBlockType( | |
// The name of our block. Must be a string with prefix. Example: my-plugin/my-custom-block. | |
'nelio/testimonial-block', { | |
// The title of our block. | |
title: i18n.__( 'Testimonial' ), | |
// Dashicon icon for our block. | |
icon: 'megaphone', | |
// The category of the block. | |
category: 'common', | |
// Necessary for saving block content. | |
attributes: { | |
name: { | |
type: 'array', | |
source: 'children', | |
selector: 'p.nelio-testimonial-name', | |
}, | |
position: { | |
type: 'array', | |
source: 'children', | |
selector: 'p.nelio-testimonial-position', | |
}, | |
testimonial: { | |
type: 'array', | |
source: 'children', | |
selector: 'p', | |
}, | |
mediaID: { | |
type: 'number', | |
}, | |
mediaURL: { | |
type: 'string', | |
source: 'attribute', | |
selector: 'img', | |
attribute: 'src', | |
}, | |
alignment: { | |
type: 'string', | |
default: 'center', | |
} | |
}, | |
edit: function( props ) { | |
... | |
}, | |
save: function( props ) { | |
... | |
} | |
} ); | |
} )( | |
window.wp.blocks, | |
window.wp.components, | |
window.wp.i18n, | |
window.wp.element, | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment