Repository navigation
Editor: Register the core entity actions on the server - #14509
jorgefilipecosta wants to merge 2 commits into
Conversation
3ea03ed to
cd033be
Compare
Loads `register_core_entity_actions()` from the `core-actions` package, which registers the actions of posts, pages, patterns and template parts through the entity actions API at priority 0, so a plugin can unregister or replace them. The build copies its PHP files to `wp-includes/build/scripts/core-actions/`. The post editor also preloads the actions of the post type it edits. Synced from WordPress/gutenberg#84660. See #66343.
cd033be to
4c9fe2c
Compare
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
…ludes them. The core actions are copied from the Gutenberg build, so their tests are skipped while the pinned build does not include them. See #66343.
|
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 Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Backports the PHP changes of WordPress/gutenberg#84660, a follow-up to #14276.
Gutenberg now registers the core actions (Trash, Rename, Duplicate…) on the server, through the entity actions API, and the editors read them from
/wp/v2/entity-actions. This PR makes Core register them too.This PR:
@wordpress/core-actionsfrom the Gutenberg build towp-includes/build/scripts/core-actions/, in thegutenberg-phpcopy task that copiesroutes.phpandpages.php, and loads itsindex.phpfromwp-settings.phpthe same way._wp_preload_entity_actions(), which preloads the actions of the post type the post editor edits.register_core_entity_actions(), without the "Duplicate…" action of posts, which is only registered in the Gutenberg plugin.Some notes:
wp-includes/build/scripts/core-actions/doesn't exist, so the new tests are skipped and nothing is registered.gutenbergtext domain from the labels, so they are translated with the default one. Thetest_the_labels_are_translated_with_the_default_text_domaintest covers it.Testing Instructions
gutenberg.shainpackage.jsontotrunk, then runnpm run gutenberg:downloadandnpm run build:dev.wp-admin/site-editor.php?p=%2Fpage. In the console, runawait wp.apiFetch( { path: '/wp/v2/entity-actions?kind=postType&name=page' } )and verify it returns the actions of pages and the@wordpress/core-actions/post_type_supportsmodule./wp/v2/entity-actions, which is preloaded.npm run test:php -- --group entity-actions.Gutenberg PR: WordPress/gutenberg#84660
Trac ticket: https://core.trac.wordpress.org/ticket/66343
Use of AI Tools
AI assistance: Yes
Used for: porting the code and the tests from the Gutenberg PR, and drafting this description; reviewed and edited by me.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.