2020-07-01 14:29:03 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Used to set up all core blocks used with the block editor.
|
|
|
|
*
|
|
|
|
* @package WordPress
|
|
|
|
*/
|
|
|
|
|
2022-07-08 14:34:14 +02:00
|
|
|
define( 'BLOCKS_PATH', ABSPATH . WPINC . '/blocks/' );
|
|
|
|
|
2020-07-01 14:29:03 +02:00
|
|
|
// Include files required for core blocks registration.
|
2022-07-08 14:34:14 +02:00
|
|
|
require BLOCKS_PATH . 'legacy-widget.php';
|
|
|
|
require BLOCKS_PATH . 'widget-group.php';
|
|
|
|
require BLOCKS_PATH . 'require-dynamic-blocks.php';
|
2020-07-01 14:29:03 +02:00
|
|
|
|
2020-07-02 19:22:03 +02: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 14:34:14 +02:00
|
|
|
$block_folders = require BLOCKS_PATH . 'require-static-blocks.php';
|
2020-07-02 19:22:03 +02:00
|
|
|
foreach ( $block_folders as $block_folder ) {
|
2021-05-19 15:52:00 +02:00
|
|
|
register_block_type(
|
2022-07-08 14:34:14 +02:00
|
|
|
BLOCKS_PATH . $block_folder
|
2020-07-02 19:22:03 +02:00
|
|
|
);
|
|
|
|
}
|
2020-07-01 14:29:03 +02:00
|
|
|
}
|
2020-07-02 19:22:03 +02:00
|
|
|
add_action( 'init', 'register_core_block_types_from_metadata' );
|