@wordpress/block-library
Version:
Block library for the WordPress editor.
21 lines (19 loc) • 513 B
JavaScript
/**
* WordPress dependencies
*/
import { registerBlockType } from '@wordpress/blocks';
/**
* Function to register an individual block.
*
* @param {Object} block The block to be registered.
*
* @return {?WPBlockType} The block, if it has been successfully registered;
* otherwise `undefined`.
*/
export default function initBlock( block ) {
if ( ! block ) {
return;
}
const { metadata, settings, name } = block;
return registerBlockType( { name, ...metadata }, settings );
}