Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
14434ba
Actions API: Add the server-side registry and REST route
jorgefilipecosta Oct 13, 2026
6a6944d
Core Data: Add a private selector for the actions registered on the s…
jorgefilipecosta Oct 13, 2026
5dd5f47
Editor: Show the actions registered on the server
jorgefilipecosta Oct 14, 2026
14ff16e
E2E: Add a test plugin that adds an action to pages
jorgefilipecosta Oct 14, 2026
7004dbf
Add the pull request link to the changelog entries
jorgefilipecosta Oct 14, 2026
a632929
Actions API: Report the values of an action that DataViews does not s…
jorgefilipecosta Oct 14, 2026
40ff2a2
Editor: Keep the id the server registers an action with
jorgefilipecosta Oct 14, 2026
4b8003b
Editor: Report when the actions of an entity cannot be loaded
jorgefilipecosta Oct 14, 2026
b28b4d3
Actions API: Preload the actions of the post type the post editor edits
jorgefilipecosta Oct 14, 2026
19d0d8f
Actions API: Leave the route to a post type or taxonomy whose items a…
jorgefilipecosta Oct 14, 2026
d594fd9
Actions API: Keep the registry closed when its action fires again
jorgefilipecosta Oct 14, 2026
853a569
Actions API: Fix the validation of ids, entities, and module ids
jorgefilipecosta Oct 14, 2026
37c945e
Actions API: Pass no argument from admin_footer to the modules callback
jorgefilipecosta Oct 14, 2026
ade0509
Actions API: Drop the hook bookkeeping the test case already does
jorgefilipecosta Oct 14, 2026
1befd30
Editor: Mock the script module of the loader test with vi.doMock()
jorgefilipecosta Oct 14, 2026
dd4d804
Actions API: Keep only the server code
jorgefilipecosta Oct 14, 2026
526b64a
Actions API: Rename to entity actions
jorgefilipecosta Oct 14, 2026
ef528ff
Actions API: Rename the REST route to wp/v2/entity-actions
jorgefilipecosta Oct 14, 2026
6e2dec6
Actions API: Add the backport changelog entry
jorgefilipecosta Oct 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions backport-changelog/7.2/14276.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
https://github.com/WordPress/wordpress-develop/pull/14276

* https://github.com/WordPress/gutenberg/pull/84650
64 changes: 64 additions & 0 deletions lib/class-wp-entity-actions-registry-gutenberg.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?php
/**
* Actions registry of the plugin.
*
* @package gutenberg
*/

class WP_Entity_Actions_Registry_Gutenberg extends WP_Entity_Actions_Registry {

/**
* Returns the shared registry instance.
*
* This class intentionally does not redeclare the static `$instance`
* property, so that it can be shared between `WP_Entity_Actions_Registry` and
* `WP_Entity_Actions_Registry_Gutenberg`.
*
* In other words, consumers can (and should) continue to call
* `WP_Entity_Actions_Registry::get_instance()` to access the registry, but they
* will receive an instance of `WP_Entity_Actions_Registry_Gutenberg`.
*
* @return WP_Entity_Actions_Registry_Gutenberg The registry.
*/
public static function get_instance() {
if ( ! self::$instance instanceof self ) {
$core_registry = self::$instance;
$registry = new self();

/*
* Note that the base registry enforces lazy registration of
* actions, such that actions are only registered well after the
* 'init' hook has fired.
*
* This means that, in practice, it's likely impossible that we
* find ourselves in a situation where there is data in the
* properties of the instance of `WP_Entity_Actions_Registry` that needs
* to be copied to the instance of `WP_Entity_Actions_Registry_Gutenberg`.
*
* THUS, THE ASSIGNMENTS BELOW REFLECT AN ABUNDANCE OF CAUTION AND
* NOT AN ACTUAL NEED.
*
* @see WP_Entity_Actions_Registry::initialize()
* @see WP_Entity_Actions_Registry::doing_entity_actions_api_init()
*/
if ( null !== $core_registry ) {
$registry->actions = $core_registry->actions;
$registry->action_modules = $core_registry->action_modules;
$registry->initialized = $core_registry->initialized;
}

self::$instance = $registry;
}

return self::$instance;
}
}

/**
* Replaces the core actions registry with the plugin one, so that all code
* using `WP_Entity_Actions_Registry::get_instance()` receives it.
*/
function gutenberg_override_wp_entity_actions_registry() {
WP_Entity_Actions_Registry_Gutenberg::get_instance();
}
add_action( 'init', 'gutenberg_override_wp_entity_actions_registry', 1 );
Loading
Loading