| 1 |
/** |
| 2 |
* WordPress dependencies |
| 3 |
*/ |
| 4 |
import { registerBlockType } from '@wordpress/blocks'; |
| 5 |
|
| 6 |
/** |
| 7 |
* Function to register an individual block. |
| 8 |
* |
| 9 |
* @param {Object} block The block to be registered. |
| 10 |
* |
| 11 |
* @return {WPBlockType | undefined} The block, if it has been successfully registered; |
| 12 |
* otherwise `undefined`. |
| 13 |
*/ |
| 14 |
export default function initBlock( block ) { |
| 15 |
if ( ! block ) { |
| 16 |
return; |
| 17 |
} |
| 18 |
const { metadata, settings, name } = block; |
| 19 |
return registerBlockType( { name, ...metadata }, settings ); |
| 20 |
} |