mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 09:37:42 +01:00
REST API: Restore the $creating
parameter of rest_after_save_widget
action.
This is consistent with other similar REST API actions. Partially reverts [51071], except for DocBlock formatting fixes. Props TimothyBlynJacobs. See #53317. Built from https://develop.svn.wordpress.org/trunk@51074 git-svn-id: http://core.svn.wordpress.org/trunk@50683 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
13d9212bf4
commit
47231831f7
@ -414,14 +414,14 @@ class WP_REST_Widgets_Controller extends WP_REST_Controller {
|
||||
$id_base = $parsed_id['id_base'];
|
||||
$number = isset( $parsed_id['number'] ) ? $parsed_id['number'] : null;
|
||||
$widget_object = $wp_widget_factory->get_widget_object( $id_base );
|
||||
$update = true;
|
||||
$creating = false;
|
||||
} elseif ( $request['id_base'] ) {
|
||||
// Saving a new widget.
|
||||
$id_base = $request['id_base'];
|
||||
$widget_object = $wp_widget_factory->get_widget_object( $id_base );
|
||||
$number = $widget_object ? next_widget_id_number( $id_base ) : null;
|
||||
$id = $widget_object ? $id_base . '-' . $number : $id_base;
|
||||
$update = false;
|
||||
$creating = true;
|
||||
} else {
|
||||
return new WP_Error(
|
||||
'rest_invalid_widget',
|
||||
@ -525,9 +525,9 @@ class WP_REST_Widgets_Controller extends WP_REST_Controller {
|
||||
* @param string $id ID of the widget being saved.
|
||||
* @param string $sidebar_id ID of the sidebar containing the widget being saved.
|
||||
* @param WP_REST_Request $request Request object.
|
||||
* @param bool $update Whether this is an existing widget being updated.
|
||||
* @param bool $creating True when creating a widget, false when updating.
|
||||
*/
|
||||
do_action( 'rest_after_save_widget', $id, $sidebar_id, $request, $update );
|
||||
do_action( 'rest_after_save_widget', $id, $sidebar_id, $request, $creating );
|
||||
|
||||
return $id;
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.8-alpha-51073';
|
||||
$wp_version = '5.8-alpha-51074';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user