equal
deleted
inserted
replaced
48 // Preload server-registered block schemas. |
48 // Preload server-registered block schemas. |
49 wp_add_inline_script( |
49 wp_add_inline_script( |
50 'wp-blocks', |
50 'wp-blocks', |
51 'wp.blocks.unstable__bootstrapServerSideBlockDefinitions(' . wp_json_encode( get_block_editor_server_block_settings() ) . ');' |
51 'wp.blocks.unstable__bootstrapServerSideBlockDefinitions(' . wp_json_encode( get_block_editor_server_block_settings() ) . ');' |
52 ); |
52 ); |
|
53 |
|
54 // Preload server-registered block bindings sources. |
|
55 $registered_sources = get_all_registered_block_bindings_sources(); |
|
56 if ( ! empty( $registered_sources ) ) { |
|
57 $filtered_sources = array(); |
|
58 foreach ( $registered_sources as $source ) { |
|
59 $filtered_sources[] = array( |
|
60 'name' => $source->name, |
|
61 'label' => $source->label, |
|
62 'usesContext' => $source->uses_context, |
|
63 ); |
|
64 } |
|
65 $script = sprintf( 'for ( const source of %s ) { wp.blocks.registerBlockBindingsSource( source ); }', wp_json_encode( $filtered_sources ) ); |
|
66 wp_add_inline_script( |
|
67 'wp-blocks', |
|
68 $script |
|
69 ); |
|
70 } |
53 |
71 |
54 wp_add_inline_script( |
72 wp_add_inline_script( |
55 'wp-blocks', |
73 'wp-blocks', |
56 sprintf( 'wp.blocks.setCategories( %s );', wp_json_encode( get_block_categories( $block_editor_context ) ) ), |
74 sprintf( 'wp.blocks.setCategories( %s );', wp_json_encode( get_block_categories( $block_editor_context ) ) ), |
57 'after' |
75 'after' |