Changeset 52374 for trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php
- Timestamp:
- 12/14/2021 04:29:03 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php
r52342 r52374 378 378 379 379 $links = array( 380 'self' 380 'self' => array( 381 381 'href' => rest_url( trailingslashit( $base ) . $id ), 382 ),383 'collection' => array(384 'href' => rest_url( $base ),385 382 ), 386 383 ); … … 536 533 } 537 534 538 $theme = WP_Theme_JSON_Resolver::get_merged_data( 'theme' ); 539 $styles = $theme->get_raw_data()['styles']; 540 $settings = $theme->get_settings(); 541 $result = array( 542 'settings' => $settings, 543 'styles' => $styles, 535 $theme = WP_Theme_JSON_Resolver::get_merged_data( 'theme' ); 536 $data = array(); 537 $fields = $this->get_fields_for_response( $request ); 538 539 if ( rest_is_field_included( 'settings', $fields ) ) { 540 $data['settings'] = $theme->get_settings(); 541 } 542 543 if ( rest_is_field_included( 'styles', $fields ) ) { 544 $data['styles'] = $theme->get_raw_data()['styles']; 545 } 546 547 $context = ! empty( $request['context'] ) ? $request['context'] : 'view'; 548 $data = $this->add_additional_fields_to_object( $data, $request ); 549 $data = $this->filter_response_by_context( $data, $context ); 550 551 $response = rest_ensure_response( $data ); 552 553 $links = array( 554 'self' => array( 555 'href' => rest_url( sprintf( '%s/%s/themes/%s', $this->namespace, $this->rest_base, $request['stylesheet'] ) ), 556 ), 544 557 ); 545 $response = rest_ensure_response( $result ); 558 559 $response->add_links( $links ); 546 560 547 561 return $response;
Note: See TracChangeset
for help on using the changeset viewer.