Media: Allow hiding of ‘View attachment page’ link in media modal.

If an empty string is supplied to the `attachment_link` filter the ‘View attachment page’ link will be hidden in the media modal.
Props limera1n, garrett-eclipse, joemcgill, Mista-Flo, hellofromTonya.
Fixes #48325.

Built from https://develop.svn.wordpress.org/trunk@49222


git-svn-id: http://core.svn.wordpress.org/trunk@48984 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
antpb 2020-10-20 02:29:06 +00:00
parent f7c520c1d5
commit 6b90568840
3 changed files with 14 additions and 4 deletions

View File

@ -452,6 +452,8 @@ function get_attachment_link( $post = null, $leavename = false ) {
* Filters the permalink for an attachment.
*
* @since 2.0.0
* @since 5.6.0 Providing an empty string will now disable
* the view attachment page link on the media modal.
*
* @param string $link The attachment's permalink.
* @param int $post_id Attachment ID.

View File

@ -514,11 +514,19 @@ function wp_print_media_templates() {
</div>
<div class="actions">
<a class="view-attachment" href="{{ data.link }}"><?php _e( 'View attachment page' ); ?></a>
<# if ( data.can.save ) { #> |
<# if ( data.link ) { #>
<a class="view-attachment" href="{{ data.link }}"><?php _e( 'View attachment page' ); ?></a>
<# } #>
<# if ( data.can.save ) { #>
<# if ( data.link ) { #>
<span class="links-separator">|</span>
<# } #>
<a href="{{ data.editLink }}"><?php _e( 'Edit more details' ); ?></a>
<# } #>
<# if ( ! data.uploading && data.can.remove ) { #> |
<# if ( ! data.uploading && data.can.remove ) { #>
<# if ( data.link || data.can.save ) { #>
<span class="links-separator">|</span>
<# } #>
<?php if ( MEDIA_TRASH ) : ?>
<# if ( 'trash' === data.status ) { #>
<button type="button" class="button-link untrash-attachment"><?php _e( 'Restore from Trash' ); ?></button>

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.6-alpha-49221';
$wp_version = '5.6-alpha-49222';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.