- Timestamp:
- 06/02/2024 07:25:03 PM (10 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php
r56586 r58282 225 225 * @since 5.0.0 226 226 * @since 5.9.0 Renamed `$theme` to `$item` to match parent class for PHP 8 named parameter support. 227 * @since 6.6.0 Added `stylesheet_uri` and `template_uri` fields. 227 228 * 228 229 * @param WP_Theme $item Theme object. … … 330 331 if ( rest_is_field_included( 'is_block_theme', $fields ) ) { 331 332 $data['is_block_theme'] = $theme->is_block_theme(); 333 } 334 335 if ( rest_is_field_included( 'stylesheet_uri', $fields ) ) { 336 if ( $this->is_same_theme( $theme, $current_theme ) ) { 337 $data['stylesheet_uri'] = get_stylesheet_directory_uri(); 338 } else { 339 $data['stylesheet_uri'] = $theme->get_stylesheet_directory_uri(); 340 } 341 } 342 343 if ( rest_is_field_included( 'template_uri', $fields ) ) { 344 if ( $this->is_same_theme( $theme, $current_theme ) ) { 345 $data['template_uri'] = get_template_directory_uri(); 346 } else { 347 $data['template_uri'] = $theme->get_template_directory_uri(); 348 } 332 349 } 333 350 … … 448 465 'readonly' => true, 449 466 ), 467 'stylesheet_uri' => array( 468 'description' => __( 'The uri for the theme\'s stylesheet directory.' ), 469 'type' => 'string', 470 'format' => 'uri', 471 'readonly' => true, 472 ), 450 473 'template' => array( 451 474 'description' => __( 'The theme\'s template. If this is a child theme, this refers to the parent theme, otherwise this is the same as the theme\'s stylesheet.' ), 452 475 'type' => 'string', 476 'readonly' => true, 477 ), 478 'template_uri' => array( 479 'description' => __( 'The uri for the theme\'s template directory. If this is a child theme, this refers to the parent theme, otherwise this is the same as the theme\'s stylesheet directory.' ), 480 'type' => 'string', 481 'format' => 'uri', 453 482 'readonly' => true, 454 483 ),
Note: See TracChangeset
for help on using the changeset viewer.