wp/wp-includes/blocks/index.php
changeset 16 a86126ab1dd4
child 18 be944660c56a
equal deleted inserted replaced
15:3d4e9c994f10 16:a86126ab1dd4
       
     1 <?php
       
     2 /**
       
     3  * Used to set up all core blocks used with the block editor.
       
     4  *
       
     5  * @package WordPress
       
     6  */
       
     7 
       
     8 // Include files required for core blocks registration.
       
     9 require ABSPATH . WPINC . '/blocks/archives.php';
       
    10 require ABSPATH . WPINC . '/blocks/block.php';
       
    11 require ABSPATH . WPINC . '/blocks/calendar.php';
       
    12 require ABSPATH . WPINC . '/blocks/categories.php';
       
    13 require ABSPATH . WPINC . '/blocks/latest-comments.php';
       
    14 require ABSPATH . WPINC . '/blocks/latest-posts.php';
       
    15 require ABSPATH . WPINC . '/blocks/rss.php';
       
    16 require ABSPATH . WPINC . '/blocks/search.php';
       
    17 require ABSPATH . WPINC . '/blocks/shortcode.php';
       
    18 require ABSPATH . WPINC . '/blocks/social-link.php';
       
    19 require ABSPATH . WPINC . '/blocks/tag-cloud.php';
       
    20 
       
    21 /**
       
    22  * Registers core block types using metadata files.
       
    23  * Dynamic core blocks are registered separately.
       
    24  *
       
    25  * @since 5.5.0
       
    26  */
       
    27 function register_core_block_types_from_metadata() {
       
    28 	$block_folders = array(
       
    29 		'audio',
       
    30 		'button',
       
    31 		'buttons',
       
    32 		'classic',
       
    33 		'code',
       
    34 		'column',
       
    35 		'columns',
       
    36 		'file',
       
    37 		'gallery',
       
    38 		'group',
       
    39 		'heading',
       
    40 		'html',
       
    41 		'image',
       
    42 		'list',
       
    43 		'media-text',
       
    44 		'missing',
       
    45 		'more',
       
    46 		'nextpage',
       
    47 		'paragraph',
       
    48 		'preformatted',
       
    49 		'pullquote',
       
    50 		'quote',
       
    51 		'separator',
       
    52 		'social-links',
       
    53 		'spacer',
       
    54 		'subhead',
       
    55 		'table',
       
    56 		'text-columns',
       
    57 		'verse',
       
    58 		'video',
       
    59 	);
       
    60 
       
    61 	foreach ( $block_folders as $block_folder ) {
       
    62 		register_block_type_from_metadata(
       
    63 			ABSPATH . WPINC . '/blocks/' . $block_folder
       
    64 		);
       
    65 	}
       
    66 }
       
    67 add_action( 'init', 'register_core_block_types_from_metadata' );