PluginProbe
Gutenberg / 23.2.0
Gutenberg v23.2.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
gutenberg / lib / experimental / guidelines / load.php
lib/experimental/guidelines
class-gutenberg-content-guidelines-rest-controller.php 24.3 KB 4 months ago class-gutenberg-content-guidelines-revisions-controller.php 10.3 KB 4 months ago class-gutenberg-guidelines-post-type.php 12.1 KB 3 months ago class-gutenberg-guidelines-rest-controller.php 1.4 KB 3 months ago guidelines.php 3.6 KB 4 months ago index.php 2.1 KB 3 months ago load.php 1.2 KB 4 months ago

load.php in Gutenberg 23.2.0, at lib/experimental/guidelines/load.php

44 lines 1.2 KB Raw Download Zip
1 <?php
2 /**
3 * Bootstraps the Guidelines page in wp-admin under Settings.
4 *
5 * @package gutenberg
6 */
7
8 add_action( 'admin_menu', 'gutenberg_register_guidelines_settings_submenu', 10 );
9 add_action( 'admin_enqueue_scripts', 'gutenberg_guidelines_enqueue_block_registry_scripts', 5 );
10
11 /**
12 * Registers the Guidelines submenu item under Settings.
13 * Uses the same layout/style as the Font Library admin page (wp-admin integrated).
14 */
15 function gutenberg_register_guidelines_settings_submenu() {
16 add_submenu_page(
17 'options-general.php',
18 __( 'Guidelines', 'gutenberg' ),
19 __( 'Guidelines', 'gutenberg' ),
20 'manage_options',
21 'guidelines-wp-admin',
22 'gutenberg_guidelines_wp_admin_render_page'
23 );
24 }
25
26 /**
27 * Enqueues wp-block-library on the Guidelines admin page so
28 * registerCoreBlocks() is available when the app bootstraps the block
29 * registry (Core blocks only) on the client.
30 *
31 * Priority 5 ensures this runs before the main asset enqueue (priority 10).
32 */
33 function gutenberg_guidelines_enqueue_block_registry_scripts( $hook_suffix ) {
34 if ( ! current_user_can( 'manage_options' ) ) {
35 return;
36 }
37
38 if ( 'settings_page_guidelines-wp-admin' !== $hook_suffix ) {
39 return;
40 }
41
42 wp_enqueue_script( 'wp-block-library' );
43 }
44