Routing: Allow plugins to register custom site editor like pages#73120
Conversation
|
Size Change: +20 B (0%) Total Size: 2.47 MB
ℹ️ View Unchanged
|
| */ | ||
| function gutenberg_boot_register_default_menu_items() { | ||
| register_gutenberg_boot_menu_item( 'home', __( 'Home', 'gutenberg' ), '/', '' ); | ||
| register_gutenberg_boot_menu_item( 'posts', __( 'Posts', 'gutenberg' ), '/types/post', '' ); |
There was a problem hiding this comment.
There's something wrong with the redirect for this route for me.. If I change this to the resulted path after the redirection (/types/post/list/all) it works, but not like it is now.
Is it happening for you?
There was a problem hiding this comment.
Yes, I can reproduce now, It used to work at some point haha :)
There was a problem hiding this comment.
The issue is that bundling tanstack router in two separate bundles prevented the redirects from being caught. I swear it worked for me before though :P
I pushed a temporary fix, I think a longer term fix is to extract the "router" to a shared package.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Flaky tests detected in 473a69f. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/19232241409
|
Related #70862
What?
Adds support for defining admin pages with file-based routing in the
@wordpress/buildpackage.Why?
Plugins need a way to create admin pages with client-side routing without manually writing PHP registration boilerplate. This enables a consistent pattern for building modern admin interfaces across WordPress plugins. Also allows cross-plugin extensibility of said pages.
How?
wpPlugin.pagesconfiguration to define admin pagesTesting Instructions
You can try the Gutenberg Boot demo page:
http://localhost:8888/wp-admin/admin.php?page=gutenberg-bootYou can also try creating custom pages:
"pages": ["my-admin-page"]towpPluginin your rootpackage.jsonroutes/home/package.jsonwith"page": "my-admin-page"stage.tsxcomponent to the route directorynpm run buildbuild/pages/andbuild/routes/build/index.phpin your plugin and register the menu page