2020-07-01 08:29:03 -04:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Used to set up all core blocks used with the block editor.
|
|
|
|
*
|
|
|
|
* @package WordPress
|
|
|
|
*/
|
|
|
|
|
2022-07-08 08:34:14 -04:00
|
|
|
define( 'BLOCKS_PATH', ABSPATH . WPINC . '/blocks/' );
|
|
|
|
|
2020-07-01 08:29:03 -04:00
|
|
|
// Include files required for core blocks registration.
|
2022-07-08 08:34:14 -04:00
|
|
|
require BLOCKS_PATH . 'legacy-widget.php';
|
|
|
|
require BLOCKS_PATH . 'widget-group.php';
|
|
|
|
require BLOCKS_PATH . 'require-dynamic-blocks.php';
|
2020-07-01 08:29:03 -04:00
|
|
|
|
2020-07-02 13:22:03 -04:00
|
|
|
/**
|
|
|
|
* Registers core block types using metadata files.
|
|
|
|
* Dynamic core blocks are registered separately.
|
|
|
|
*
|
|
|
|
* @since 5.5.0
|
|
|
|
*/
|
|
|
|
function register_core_block_types_from_metadata() {
|
2022-07-08 08:34:14 -04:00
|
|
|
$block_folders = require BLOCKS_PATH . 'require-static-blocks.php';
|
2020-07-02 13:22:03 -04:00
|
|
|
foreach ( $block_folders as $block_folder ) {
|
2021-05-19 09:52:00 -04:00
|
|
|
register_block_type(
|
2022-07-08 08:34:14 -04:00
|
|
|
BLOCKS_PATH . $block_folder
|
2020-07-02 13:22:03 -04:00
|
|
|
);
|
|
|
|
}
|
2020-07-01 08:29:03 -04:00
|
|
|
}
|
2020-07-02 13:22:03 -04:00
|
|
|
add_action( 'init', 'register_core_block_types_from_metadata' );
|