Make WordPress Core

Opened 13 years ago

Closed 11 years ago

#17580 closed enhancement (invalid)

get_media_item(): add filter to better control "buttons" in media upload and make more performant if buttons are already set

Reported by: mitchoyoshitaka's profile mitchoyoshitaka Owned by: mitchoyoshitaka's profile mitchoyoshitaka
Milestone: Priority: normal
Severity: normal Version: 3.1.3
Component: Media Keywords: needs-refresh
Focuses: performance Cc:

Description

Two issues in get_media_item():

  1. There's no good, clean way to modify the "buttons" (things which get stored lumped together in $form_fieldsbuttons?) in the Media Upload, except for the "delete" and "send" (aka "insert into post") which can be controlled via the 'get_media_item_args'. Add a filter for that.
  2. Right now we construct the HTML snippets for different buttons, as $send, $delete, and $thumbnail... and then checking whether $form_fieldsbuttons? is already set or not, and then only using them if it's not already set. If a plugin already pre-specifies the buttons HTML, this computation is completely wasteful. Move this conditional earlier.
  3. (Terribly minor:) If any of these buttons aren't actually used, <td class='savesend'/> is produced with extra whitespace in it. This is a reflection of the poor design of the code which prints this HTML.

Attachments (1)

17580.diff (5.5 KB) - added by mitchoyoshitaka 13 years ago.

Download all attachments as: .zip

Change History (3)

#1 @coffee2code
12 years ago

  • Keywords needs-refresh added; has-patch removed
  • Milestone changed from Awaiting Review to Future Release
  • Type changed from defect (bug) to enhancement
  • Version set to 3.1.3

Patch no longer applies cleanly (currently r20610).

#2 @nacin
11 years ago

  • Component changed from Performance to Media
  • Focuses performance added
  • Milestone Future Release deleted
  • Resolution set to invalid
  • Status changed from new to closed

Goodbye, get_media_item(), I hated you and I am glad 3.5 made you obsolete. :-)

Note: See TracTickets for help on using tickets.