Opened 19 months ago

Last modified 10 months ago

#19181 new enhancement

Make image_link_input_fields filterable to add buttons

Reported by: ryanimel Owned by:
Priority: normal Milestone: Awaiting Review
Component: Media Version: 2.7
Severity: normal Keywords: has-patch
Cc:

Description

This patch makes the image_link_input_fields function filterable, so that additional buttons could be added to the Link URL section when inserting an image into a post.

In my case, I want to be able to link an image to the post it belongs to. It's a weird/tiny use case, but this filter will let me use a plugin to add it myself.

Attachments (3)

imagelinkfilter.diff (1.2 KB) - added by ryanimel 19 months ago.
media.php (69.6 KB) - added by ryanimel 11 months ago.
Refreshed and improved version of earlier patch.
imagelinkfilter_refresh.diff (1.5 KB) - added by ryanimel 10 months ago.
(Sigh. Best if I upload the patch and not the file it applies to, eh?)

Download all attachments as: .zip

Change History (8)

If it helps, this is the kind of plugin I have in mind to use once this patch is introduced: http://cl.ly/2s392s1v2B2Y051A1h1x

Rather than a general filter on HTML output, we may wish to make an associative array of the type=button's, then filter that, then echo it.

Should be noted the patch is stale thanks to #13544. Seriously. ;)

Figured I would revisit this ticket and idea. Attaching a refreshed patch with the array of buttons filtered. How's it look?

Refreshed and improved version of earlier patch.

Could probably just return that HTML input concatenated with the imploded content of the array and maintain the new lines, rather than storing in the $output variable without them. I'm sure someone else will correct me if that's not the usual style, though :)

Good call. Updated the patch. Thanks :)

(Sigh. Best if I upload the patch and not the file it applies to, eh?)

Note: See TracTickets for help on using tickets.