PluginProbe
Gutenberg / 5.7.0
Gutenberg v5.7.0
23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 12.6.0 7.4.0 All 402 releases
gutenberg / lib / widgets-page.php

widgets-page.php in Gutenberg 5.7.0, at lib/widgets-page.php

45 lines 961 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Bootstraping the Gutenberg widgets page.
4 *
5 * @package gutenberg
6 */
7
8 /**
9 * The main entry point for the Gutenberg widgets page.
10 *
11 * @since 5.2.0
12 */
13 function the_gutenberg_widgets() {
14 ?>
15 <div id="widgets-editor" class="blocks-widgets-container">
16 </div>
17 <?php
18 }
19
20 /**
21 * Initialize the Gutenberg widgets page.
22 *
23 * @since 5.2.0
24 *
25 * @param string $hook Page.
26 */
27 function gutenberg_widgets_init( $hook ) {
28 if ( 'gutenberg_page_gutenberg-widgets' !== $hook ) {
29 return;
30 }
31
32 wp_add_inline_script(
33 'wp-edit-widgets',
34 'wp.editWidgets.initialize( "widgets-editor" );'
35 );
36 // Preload server-registered block schemas.
37 wp_add_inline_script(
38 'wp-blocks',
39 'wp.blocks.unstable__bootstrapServerSideBlockDefinitions(' . wp_json_encode( get_block_editor_server_block_settings() ) . ');'
40 );
41 wp_enqueue_script( 'wp-edit-widgets' );
42 wp_enqueue_style( 'wp-edit-widgets' );
43 }
44 add_action( 'admin_enqueue_scripts', 'gutenberg_widgets_init' );
45