Changeset 61661
- Timestamp:
- 02/17/2026 01:20:36 PM (6 weeks ago)
- Location:
- trunk
- Files:
-
- 2 added
- 3 edited
-
src/wp-includes/block-supports/auto-register.php (added)
-
src/wp-includes/blocks.php (modified) (1 diff)
-
src/wp-includes/default-filters.php (modified) (1 diff)
-
src/wp-settings.php (modified) (1 diff)
-
tests/phpunit/tests/block-supports/auto-register.php (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/blocks.php
r61650 r61661 3132 3132 return $arg; 3133 3133 } 3134 3135 /** 3136 * Exposes blocks with autoRegister flag for ServerSideRender in the editor. 3137 * 3138 * Detects blocks that have the autoRegister flag set in their supports 3139 * and passes them to JavaScript for auto-registration with ServerSideRender. 3140 * 3141 * @access private 3142 * @since 7.0.0 3143 */ 3144 function _wp_enqueue_auto_register_blocks() { 3145 $auto_register_blocks = array(); 3146 $registered_blocks = WP_Block_Type_Registry::get_instance()->get_all_registered(); 3147 3148 foreach ( $registered_blocks as $block_name => $block_type ) { 3149 if ( ! empty( $block_type->supports['autoRegister'] ) && ! empty( $block_type->render_callback ) ) { 3150 $auto_register_blocks[] = $block_name; 3151 } 3152 } 3153 3154 if ( ! empty( $auto_register_blocks ) ) { 3155 wp_add_inline_script( 3156 'wp-block-library', 3157 sprintf( 'window.__unstableAutoRegisterBlocks = %s;', wp_json_encode( $auto_register_blocks ) ), 3158 'before' 3159 ); 3160 } 3161 } -
trunk/src/wp-includes/default-filters.php
r61491 r61661 624 624 add_action( 'enqueue_block_editor_assets', 'wp_enqueue_block_editor_script_modules' ); 625 625 add_action( 'enqueue_block_editor_assets', 'wp_enqueue_global_styles_css_custom_properties' ); 626 add_action( 'enqueue_block_editor_assets', '_wp_enqueue_auto_register_blocks' ); 626 627 add_action( 'wp_print_scripts', 'wp_just_in_time_script_localization' ); 627 628 add_filter( 'print_scripts_array', 'wp_prototype_before_jquery' ); -
trunk/src/wp-settings.php
r61504 r61661 395 395 require ABSPATH . WPINC . '/block-supports/utils.php'; 396 396 require ABSPATH . WPINC . '/block-supports/align.php'; 397 require ABSPATH . WPINC . '/block-supports/auto-register.php'; 397 398 require ABSPATH . WPINC . '/block-supports/custom-classname.php'; 398 399 require ABSPATH . WPINC . '/block-supports/generated-classname.php';
Note: See TracChangeset
for help on using the changeset viewer.