Media: Add download link to media modal and attachment details.

Make it easier for users to download their uploaded media by providing a download link on the attachment details screen and in the media modal.

Props countrymusicchicago, joedolson, amin7
Fixes #41474.
Built from https://develop.svn.wordpress.org/trunk@55156


git-svn-id: http://core.svn.wordpress.org/trunk@54689 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
joedolson 2023-01-27 23:07:13 +00:00
parent fef356b375
commit ac0cb7a37b
3 changed files with 8 additions and 1 deletions

View File

@ -3336,6 +3336,9 @@ function attachment_submitbox_metadata() {
<span class="success hidden" aria-hidden="true"><?php _e( 'Copied!' ); ?></span> <span class="success hidden" aria-hidden="true"><?php _e( 'Copied!' ); ?></span>
</span> </span>
</div> </div>
<div class="misc-pub-section misc-pub-download">
<a href="<?php echo esc_attr( $att_url ); ?>" download><?php _e( 'Download file' ); ?></a>
</div>
<div class="misc-pub-section misc-pub-filename"> <div class="misc-pub-section misc-pub-filename">
<?php _e( 'File name:' ); ?> <strong><?php echo $filename; ?></strong> <?php _e( 'File name:' ); ?> <strong><?php echo $filename; ?></strong>
</div> </div>

View File

@ -529,6 +529,10 @@ function wp_print_media_templates() {
<# } #> <# } #>
<a href="{{ data.editLink }}"><?php _e( 'Edit more details' ); ?></a> <a href="{{ data.editLink }}"><?php _e( 'Edit more details' ); ?></a>
<# } #> <# } #>
<# if ( data.can.save && data.link ) { #>
<span class="links-separator">|</span>
<a href="{{ data.url }}" download><?php _e( 'Download file' ); ?></a>
<# } #>
<# if ( ! data.uploading && data.can.remove ) { #> <# if ( ! data.uploading && data.can.remove ) { #>
<# if ( data.link || data.can.save ) { #> <# if ( data.link || data.can.save ) { #>
<span class="links-separator">|</span> <span class="links-separator">|</span>

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.2-alpha-55155'; $wp_version = '6.2-alpha-55156';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.