Changes between Initial Version and Version 1 of Ticket #61205, comment 2
- Timestamp:
- 05/14/2024 04:04:36 AM (14 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #61205, comment 2
initial v1 8 8 "_links": { 9 9 "wp:theme-file-uris": [ 10 { 11 "href": "http://resolve.uri/path/image.png", 12 "name": "path/image.png", 13 "path": [ "style", "blocks", "core/group", "background", "backgroundImage" ] 14 }, 15 ] 10 { 11 "name": "img/budgie3.jpg", 12 "href": "http://localhost:8888/wp-content/themes/emptytheme/img/budgie3.jpg", 13 "target": "styles.background.backgroundImage.url", 14 "type": "image/jpeg" 15 } 16 ] 16 17 } 17 18 }}} 18 19 19 "href" and "name" are HAL reserved attributes. "path"I added to represent the path in the theme.json tree to the value that needs to be replaced.20 "href", "type" and "name" are HAL reserved attributes. "target", a valid link attribute, I added to represent the path in the theme.json tree to the value that needs to be replaced. 20 21 21 However, some responses are collections of global styles objects. For example `WP_REST_Global_Styles_Controller_Gutenberg::get_theme_items` and `WP_REST_Global_Styles_Revisions_Controller::get_items`. Therefore a property can't be added to the top-level response.22 Some responses are collections of global styles objects. For example `WP_REST_Global_Styles_Controller_Gutenberg::get_theme_items` and `WP_REST_Global_Styles_Revisions_Controller::get_items`. Therefore a property can't be added to the top-level response. 22 23 23 To get around this I've added `_links` to each item in the collection. I'm not sure that's HAL-friendly, even though HAL is pretty loose and there's no formal spec.24 To get around this I've added `_links` to each item in the collection. 24 25 25 I was going to suggest adding another, custom property to the [https://github.com/wordpress/wordpress-develop/blob/3a6cca9ff772c77c86a3cf7c5a69398acc4c2272/src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php#L513-L513, global styles object schema] if `_links` aren't allowed in collection items.26 I was going to suggest adding another, custom property to the [https://github.com/wordpress/wordpress-develop/blob/3a6cca9ff772c77c86a3cf7c5a69398acc4c2272/src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php#L513-L513, global styles object schema] if folks think links to image URIs shouldn't live under `_links`. I tend to think that HAL is flexible enough to accommodate, but keen to hear others' thoughts.