From b43344dbdcc5dc08b78af6461154a2a556f7fe1f Mon Sep 17 00:00:00 2001 From: ramon Date: Thu, 1 Feb 2024 08:49:29 +1100 Subject: [PATCH] Now that https://github.com/WordPress/wordpress-develop/pull/5655 has landed, use inherited methods for getting individual items. --- ...est-global-styles-revisions-controller.php | 50 ------------------- 1 file changed, 50 deletions(-) diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-revisions-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-revisions-controller.php index c71ada44364ef..0f780a83e44d8 100644 --- a/src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-revisions-controller.php +++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-revisions-controller.php @@ -246,56 +246,6 @@ public function get_items( $request ) { return $response; } - /** - * Retrieves one global styles revision from the collection. - * - * @since 6.5.0 - * - * @param WP_REST_Request $request Full details about the request. - * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. - */ - public function get_item( $request ) { - $parent = $this->get_parent( $request['parent'] ); - if ( is_wp_error( $parent ) ) { - return $parent; - } - - $revision = $this->get_revision( $request['id'] ); - if ( is_wp_error( $revision ) ) { - return $revision; - } - - $response = $this->prepare_item_for_response( $revision, $request ); - return rest_ensure_response( $response ); - } - - /** - * Gets the global styles revision, if the ID is valid. - * - * @since 6.5.0 - * - * @param int $id Supplied ID. - * @return WP_Post|WP_Error Revision post object if ID is valid, WP_Error otherwise. - */ - protected function get_revision( $id ) { - $error = new WP_Error( - 'rest_post_invalid_id', - __( 'Invalid global styles revision ID.' ), - array( 'status' => 404 ) - ); - - if ( (int) $id <= 0 ) { - return $error; - } - - $revision = get_post( (int) $id ); - if ( empty( $revision ) || empty( $revision->ID ) || 'revision' !== $revision->post_type ) { - return $error; - } - - return $revision; - } - /** * Prepares the revision for the REST response. *