Changeset 56566
- Timestamp:
- 09/13/2023 02:32:33 PM (11 months ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/class-wp-rest-server.php
r56193 r56566 �� 1274 1274 1275 1275 $response = new WP_REST_Response( $available ); 1276 $response->add_link( 'help', 'https://developer.wordpress.org/rest-api/' ); 1277 $this->add_active_theme_link_to_index( $response ); 1278 $this->add_site_logo_to_index( $response ); 1279 $this->add_site_icon_to_index( $response ); 1276 1277 $fields = isset( $request['_fields'] ) ? $request['_fields'] : ''; 1278 $fields = wp_parse_list( $fields ); 1279 if ( empty( $fields ) ) { 1280 $fields[] = '_links'; 1281 } 1282 1283 if ( $request->has_param( '_embed' ) ) { 1284 $fields[] = '_embedded'; 1285 } 1286 1287 if ( rest_is_field_included( '_links', $fields ) || rest_is_field_included( '_embedded', $fields ) ) { 1288 $response->add_link( 'help', 'https://developer.wordpress.org/rest-api/' ); 1289 $this->add_active_theme_link_to_index( $response ); 1290 $this->add_site_logo_to_index( $response ); 1291 $this->add_site_icon_to_index( $response ); 1292 } 1280 1293 1281 1294 /** -
trunk/tests/phpunit/tests/rest-api.php
r55562 r56566 2513 2513 $this->assertArrayHasKey( 'routes', $preload_data['/']['body'] ); 2514 2514 2515 // Filtered request only has the desired fields + links2515 // Filtered request only has the desired fields 2516 2516 $this->assertSame( 2517 2517 array_keys( $preload_data['/?_fields=description']['body'] ), 2518 array( 'description' , '_links')2518 array( 'description' ) 2519 2519 ); 2520 2520 } -
trunk/tests/phpunit/tests/rest-api/rest-server.php
r56559 r56566 1118 1118 $this->assertArrayHasKey( 'site_icon', $data ); 1119 1119 $this->assertArrayHasKey( 'site_icon_url', $data ); 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1120 1173 } 1121 1174
Note: See TracChangeset
for help on using the changeset viewer.