Repository navigation
Dashboard: register admin page route + sidebar menu (shell) #77573
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
469d0ec
b8803cd
8d195eb
145dab1
beacfdf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| <?php | ||
| /** | ||
| * Bootstraps the Dashboard Widgets page in wp-admin. | ||
| * | ||
| * @package gutenberg | ||
| */ | ||
|
|
||
| add_action( 'admin_menu', 'gutenberg_register_dashboard_widgets_menu' ); | ||
|
|
||
| /** | ||
| * Registers the Dashboard Widgets menu item. | ||
| */ | ||
| function gutenberg_register_dashboard_widgets_menu() { | ||
| add_menu_page( | ||
| __( 'Dashboard (Beta)', 'gutenberg' ), | ||
| __( 'Dashboard (Beta)', 'gutenberg' ), | ||
| 'read', | ||
| 'dashboard-wp-admin', | ||
| 'gutenberg_dashboard_wp_admin_render_page', | ||
| 'dashicons-dashboard', | ||
| 1 | ||
| ); | ||
| } | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| { | ||
| "name": "@wordpress/dashboard-route", | ||
| "version": "1.0.0", | ||
| "private": true, | ||
| "route": { | ||
| "path": "/", | ||
| "page": [ | ||
| "dashboard" | ||
| ] | ||
| }, | ||
| "dependencies": { | ||
| "@wordpress/admin-ui": "file:../../packages/admin-ui", | ||
| "@wordpress/base-styles": "file:../../packages/base-styles", | ||
| "@wordpress/element": "file:../../packages/element", | ||
| "@wordpress/i18n": "file:../../packages/i18n" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| /** | ||
| * WordPress dependencies | ||
| */ | ||
| import { Page } from '@wordpress/admin-ui'; | ||
| import { __ } from '@wordpress/i18n'; | ||
|
|
||
| function Dashboard() { | ||
| return ( | ||
| <Page title={ __( 'Dashboard' ) } headingLevel={ 1 }> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not a blocker here, but I'll open a PR to change the default to 1 for pages like these. If it merges first, we will just need to remove
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes sense, h1 is the right default for a page component. I'll drop the explicit
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. PR: #77617 Yeah or alternatively we merge with headingLevel=1 here and I'll just update mine to remove it, whichever goes first. |
||
| <div className="dashboard-widgets" /> | ||
| </Page> | ||
| ); | ||
| } | ||
|
|
||
| export const stage = Dashboard; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Later, we could replace the regular route with the experiment, and explore what backwards compatibility should look like.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, that's the direction. This shell is strictly additive so we can iterate behind the flag without touching the classic dashboard.
The BC surface is the interesting piece:
wp_add_dashboard_widget(),wp_dashboard_setup, meta box order stored in user meta, etc. We're looking at it as a separate workstream, probably through an automatic bridge that exposes legacy meta boxes as widgets in the new grid. Out of scope for this PR.