- Timestamp:
- 09/09/2021 06:35:34 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-search-controller.php
r51302 r51786 187 187 * @since 5.0.0 188 188 * @since 5.6.0 The `$id` parameter can accept a string. 189 * 190 * @param int|string $id ID of the item to prepare. 189 * @since 5.9.0 Renamed `$id` to `$item` to match parent class for PHP 8 named parameter support. 190 * 191 * @param int|string $item ID of the item to prepare. 191 192 * @param WP_REST_Request $request Request object. 192 193 * @return WP_REST_Response Response object. 193 194 */ 194 public function prepare_item_for_response( $id, $request ) { 195 public function prepare_item_for_response( $item, $request ) { 196 // Restores the more descriptive, specific name for use within this method. 197 $item_id = $item; 195 198 $handler = $this->get_search_handler( $request ); 196 199 if ( is_wp_error( $handler ) ) { … … 200 203 $fields = $this->get_fields_for_response( $request ); 201 204 202 $data = $handler->prepare_item( $i d, $fields );205 $data = $handler->prepare_item( $item_id, $fields ); 203 206 $data = $this->add_additional_fields_to_object( $data, $request ); 204 207 … … 208 211 $response = rest_ensure_response( $data ); 209 212 210 $links = $handler->prepare_item_links( $i d );213 $links = $handler->prepare_item_links( $item_id ); 211 214 $links['collection'] = array( 212 215 'href' => rest_url( sprintf( '%s/%s', $this->namespace, $this->rest_base ) ),
Note: See TracChangeset
for help on using the changeset viewer.