A hacky way to do it is to do a string replace on the tmpl-attachment-details
template:
// See wp_print_media_templates() in "wp-includes/media-template.php"
function wpse157297_print_media_templates() {
$my_link = '<a class="my_link-attachment" href="https://wordpress.stackexchange.com/questions/157297/my_link.php?url={{ data.url }}" target="_blank">' . __( 'My Link' ) . '</a>';
$nonimage="<# if ( "image" !== data.type && ! data.uploading ) { #>" . $my_link . '<# } #>';
$image = $my_link;
?>
<script>
(function ($) {
var tmpl_attachment_details = $('#tmpl-attachment-details'), html = tmpl_attachment_details.html();
tmpl_attachment_details.html(
html.replace( /<div class="uploaded">[^<]*<\/div>/, '$&<?php echo $nonimage; ?>' ).replace( '<a class="edit-attachment"', '<?php echo $image; ?>$&' )
);
})(jQuery);
</script>
<?php
}
add_action( 'print_media_templates', 'wpse157297_print_media_templates', 11 );
Apart from {{ data.url }}
, there’s {{ data.id }}
, {{ data.filename }}
etc – see wp_prepare_attachment_for_js()
in “wp-includes/media.php”