PluginProbe
Gutenberg / 18.7.1
Gutenberg v18.7.1
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 / experimental / posts / load.php

load.php in Gutenberg 18.7.1, at lib/experimental/posts/load.php

44 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Bootstraps the new posts dashboard page.
4 *
5 * @package Gutenberg
6 */
7
8 add_action( 'admin_menu', 'gutenberg_replace_posts_dashboard' );
9
10 /**
11 * Renders the new posts dashboard page.
12 */
13 function gutenberg_posts_dashboard() {
14 wp_register_style(
15 'wp-gutenberg-posts-dashboard',
16 gutenberg_url( 'build/edit-site/posts.css', __FILE__ ),
17 array( 'wp-components', 'wp-commands' )
18 );
19 wp_enqueue_style( 'wp-gutenberg-posts-dashboard' );
20 wp_add_inline_script( 'wp-edit-site', 'window.wp.editSite.initializePostsDashboard( "gutenberg-posts-dashboard" );', 'after' );
21 wp_enqueue_script( 'wp-edit-site' );
22
23 echo '<div id="gutenberg-posts-dashboard"></div>';
24 }
25
26 /**
27 * Replaces the default posts menu item with the new posts dashboard.
28 */
29 function gutenberg_replace_posts_dashboard() {
30 $gutenberg_experiments = get_option( 'gutenberg-experiments' );
31 if ( ! $gutenberg_experiments || ! array_key_exists( 'gutenberg-new-posts-dashboard', $gutenberg_experiments ) || ! $gutenberg_experiments['gutenberg-new-posts-dashboard'] ) {
32 return;
33 }
34 $ptype_obj = get_post_type_object( 'post' );
35 add_submenu_page(
36 'gutenberg',
37 $ptype_obj->labels->name,
38 $ptype_obj->labels->name,
39 'edit_posts',
40 'gutenberg-posts-dashboard',
41 'gutenberg_posts_dashboard'
42 );
43 }
44