PluginProbe
Gutenberg / 8.3.0
Gutenberg v8.3.0
24.0.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 All 403 releases
← All changes | lib/widgets.php +23 -10 7.4.08.3.0 View file →
@@ -20,9 +20,9 @@
20 20 return ! empty( $screen ) &&
21 21 (
22 22 $screen->is_block_editor() ||
23 23 'gutenberg_page_gutenberg-widgets' === $screen->id ||
24 - 'gutenberg_page_gutenberg-edit-site' === $screen->id
24 + gutenberg_is_edit_site_page( $screen->id )
25 25 );
26 26 }
27 27
28 28 /**
@@ -43,8 +43,14 @@
43 43 * screen.
44 44 */
45 45 function gutenberg_block_editor_admin_print_scripts() {
46 46 if ( gutenberg_is_block_editor() ) {
47 + /** This action is documented in wp-admin/includes/ajax-actions.php */
48 + do_action( 'load-widgets.php' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
49 + /** This action is documented in wp-admin/includes/ajax-actions.php */
50 + do_action( 'widgets.php' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
51 + /** This action is documented in wp-admin/widgets.php */
52 + do_action( 'sidebar_admin_setup' );
47 53 // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
48 54 do_action( 'admin_print_scripts-widgets.php' );
49 55 }
50 56 }
@@ -67,17 +73,8 @@
67 73 * Emulates the Widgets screen `admin_footer` when at the block editor screen.
68 74 */
69 75 function gutenberg_block_editor_admin_footer() {
70 76 if ( gutenberg_is_block_editor() ) {
71 - // The function wpWidgets.save needs this nonce to work as expected.
72 - echo implode(
73 - "\n",
74 - array(
75 - '<form method="post">',
76 - wp_nonce_field( 'save-sidebar-widgets', '_wpnonce_widgets', false ),
77 - '</form>',
78 - )
79 - );
80 77 /** This action is documented in wp-admin/admin-footer.php */
81 78 // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
82 79 do_action( 'admin_footer-widgets.php' );
83 80 }
@@ -82,8 +79,24 @@
82 79 do_action( 'admin_footer-widgets.php' );
83 80 }
84 81 }
85 82 add_action( 'admin_footer', 'gutenberg_block_editor_admin_footer' );
83 +
84 +/**
85 + * Adds a save widgets nonce required by the legacy widgets block.
86 + */
87 +function gutenberg_print_save_widgets_nonce() {
88 + // The function wpWidgets.save needs this nonce to work as expected.
89 + echo implode(
90 + "\n",
91 + array(
92 + '<form method="post">',
93 + wp_nonce_field( 'save-sidebar-widgets', '_wpnonce_widgets', false ),
94 + '</form>',
95 + )
96 + );
97 +}
98 +add_action( 'admin_footer-widgets.php', 'gutenberg_print_save_widgets_nonce' );
86 99
87 100
88 101 /**
89 102 * Returns the settings required by legacy widgets blocks.