Is there a built-in filter to add a custom icon and function to the WordPress "Uploads/Insert" toolbar? This is the toolbar that's located just above the content editor. The existing icon I want to replicate is shown in the blue circle of the image below.
I'd like to add a custom icon that loads the "Add an Image" wizard and passes a special parameter to the upload function such that the attached images get a special meta attribute they would not ordinarily get when uploaded via the standard icon.
Update: With the help of tnorthcutt's answer below, I've managed to hook into the media icon filter. From here, I should be able to attach a jQuery click event to the image or href and trigger the opening of the media-upload.php, passing a parameter to process the uploads as special...
//Upload custom images
function addMediaIcon($initcontext)
{
return $initcontext.
' <a id="myID"
href="javascript:;"
onmousedown="return false;"
onclick="return false;"
title="tooltip">
<img
src="wp-admin/images/media-button-image.gif"
onclick="javascript:alert()" title="" />
</a>';
}
add_filter('media_buttons_context', 'addMediaIcon');