kollapsminoriteten/wp-includes/blocks/index.php

30 lines
779 B
PHP
Raw Normal View History

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