#64035 closed enhancement (fixed)
Media / Attachments REST API endpoint: update attachments controller to support flip and to customize attachment fields
| Reported by: | ramonopoly | Owned by: | ramonopoly |
|---|---|---|---|
| Priority: | low | Milestone: | 6.9 |
| Component: | REST API | Version: | 6.9 |
| Severity: | minor | Keywords: | has-patch has-unit-tests |
| Cc: | Focuses: | rest-api |
Description
The Media Library editor allows flipping an object and also updating image metadata.
The Media / Attachments REST API /media/{$id}/edit endpoint is currently used to edit images in the block editor, but has limited capability in terms of editing functions.
An incremental approach is preferred here, but a first step to enhance media editor capabilities as described in
Phase 3: Collaboration > Media Library is to add this functionality, namely:
- the ability to flip an image horizontally and vertically
- the ability to send arguments to update the new image's caption, description, and title, post and alt_text fields.
Gutenberg PR 71861 is underway, which will be followed by a Core backport patch.
Change History (8)
This ticket was mentioned in PR #10041 on WordPress/wordpress-develop by @ramonopoly.
12 months ago
#1
- Keywords has-patch has-unit-tests added
@andrewserong commented on PR #10041:
12 months ago
#2
I like this change, I think it's going to be really useful to be able to add both flip support and update metadata at the same time in a single API call 👍
For some of the failures, it looks like the b/tests/qunit/fixtures/wp-api-generated.js fixtures need to be updated? I'm not quite sure how to do that, but it looks like it's generated by this PHP function / test:
@andrewserong commented on PR #10041:
12 months ago
#3
Ah, it looks like you can update the fixtures by running the PHP tests locally, but specifically the following appears to just run the init tests to regenerate those fixtures:
npm run test:php -- --filter "WP_Test_REST_Schema_Initialization"
@ramonopoly commented on PR #10041:
12 months ago
#4
For some of the failures, it looks like the b/tests/qunit/fixtures/wp-api-generated.js fixtures need to be updated?
Thanks! I had to look up a previous comment of mine to remind myself how to do it 😄
https://github.com/WordPress/wordpress-develop/pull/5604#issuecomment-1788236109
@ramonopoly commented on PR #10041:
11 months ago
#5
I'll merge this today. Thanks!
@ramonopoly commented on PR #10041:
11 months ago
#7
Committed in r60908
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
## What?
This PR is the first step to enhance media editor capabilities as described in #55238 Phase 3: Collaboration > Media Library.
It adds the following functionality:
caption,description, andtitle,postandalt_textfields.## Why?
As outlined in https://github.com/WordPress/gutenberg/issues/55238, the extended functionality will allow folks to start experimenting with a redesigned media library.
It will also allow flip controls in the existing image block toolbar.
## Testing Instructions
### Unit tests
npm run test:php -- --filter WP_Test_REST_Attachments_Controller### Manual testing
Check that existing use of the
media/{$id}/editendpoint has no regressions:media/{$id}/edittook place with the correct payload./wp-admin/upload.phpTrac ticket: https://core.trac.wordpress.org/ticket/64035