plugin updates
This commit is contained in:
@@ -51,6 +51,24 @@ wp_add_inline_script(
|
||||
'wp.blocks.unstable__bootstrapServerSideBlockDefinitions(' . wp_json_encode( get_block_editor_server_block_settings() ) . ');'
|
||||
);
|
||||
|
||||
// Preload server-registered block bindings sources.
|
||||
$registered_sources = get_all_registered_block_bindings_sources();
|
||||
if ( ! empty( $registered_sources ) ) {
|
||||
$filtered_sources = array();
|
||||
foreach ( $registered_sources as $source ) {
|
||||
$filtered_sources[] = array(
|
||||
'name' => $source->name,
|
||||
'label' => $source->label,
|
||||
'usesContext' => $source->uses_context,
|
||||
);
|
||||
}
|
||||
$script = sprintf( 'for ( const source of %s ) { wp.blocks.registerBlockBindingsSource( source ); }', wp_json_encode( $filtered_sources ) );
|
||||
wp_add_inline_script(
|
||||
'wp-blocks',
|
||||
$script
|
||||
);
|
||||
}
|
||||
|
||||
wp_add_inline_script(
|
||||
'wp-blocks',
|
||||
sprintf( 'wp.blocks.setCategories( %s );', wp_json_encode( get_block_categories( $block_editor_context ) ) ),
|
||||
|
||||
Reference in New Issue
Block a user