mirror of
git://develop.git.wordpress.org/
synced 2025-04-07 13:43:25 +02: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. git-svn-id: https://develop.svn.wordpress.org/trunk@51074 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
8aecdaaec9
commit
d935e0c94a
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user