WordPress.org

Make WordPress Core

Opened 2 years ago

Last modified 20 months ago

#35205 new feature request

Add additional hooks to the 'attachment-info' template to customise output

Reported by: simonrcodrington Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.4.2
Component: Administration Keywords:
Focuses: Cc:

Description

Hey guys,

I've been working on several sites for clients and one thing that keeps coming up is the need to customise the 'attachment info' screen when viewing media items in the fancy media modal.

http://drive.google.com/uc

You can see that the screen shows the attachment info at the top, followed additional info below (for example the file name, file type, uploaded date at the top followed by editable fields below such as title, caption etc)

All of this is defined in /wp-includes/media-template.php and pretty much hard coded, looking for the upload type and then displaying fields.

There is already an attachment_fields_to_edit action but what that does is allow you at add fields to the bottom of the existing fields as such.

http://drive.google.com/uc

I would propose a few new hooks be created inside media-template.php starting from line 338. This is the start of the attachment-info panel and it's here a few actions would be helpful.

For example a client wanted to see all of their different image sizes in the attachment screen so they could easily copy them. Currently this can only be done by editing core directly (which is a terrible idea).

http://drive.google.com/uc

Since the media modal is built dynamically with Ajax if we add hooks here developers will be able to access the media object (which contains the URL, title, id and other info). So the flexibility will be really neat.

I'm more than happy to look into this but I'd be really keep to get feedback from you guys just in case I am missing something critical (because I don't know why there is a lack of hooks here for development)

I'm thinking of adding just basic hooks like

do_action('media-attachment-info-start')

Cheers


Change History (2)

#1 @simonrcodrington
20 months ago

  • Version set to 4.4.2

Hey again guys,

I just wanted to follow up on this. It's been a while since I opened this ticket and wanted to see what I can do to encourage this to be added to core.

I'm happy to do the leg work and propose my solution but I'd love to get feedback / guidance on if this is something that others might find useful (as this is something several of my clients have asked me before)

Cheers!

#2 @Mte90
20 months ago

I think that an action is not enough because is missing the save of information.
Also the media picker is rendered with backbone.js so I think that to show a field is required a js code.

Note: See TracTickets for help on using tickets.