From b95d64f62ab921e4f70de6816868b8dd0af5021f Mon Sep 17 00:00:00 2001 From: Anthony Burchell Date: Tue, 20 Oct 2020 02:27:39 +0000 Subject: [PATCH] =?UTF-8?q?Media:=20Allow=20hiding=20of=20=E2=80=98View=20?= =?UTF-8?q?attachment=20page=E2=80=99=20link=20in=20media=20modal.=20If=20?= =?UTF-8?q?an=20empty=20string=20is=20supplied=20to=20the=20`attachment=5F?= =?UTF-8?q?link`=20filter=20the=20=E2=80=98View=20attachment=20page?= =?UTF-8?q?=E2=80=99=20link=20will=20be=20hidden=20in=20the=20media=20moda?= =?UTF-8?q?l.=20Props=20limera1n,=20garrett-eclipse,=20joemcgill,=20Mista-?= =?UTF-8?q?Flo,=20hellofromTonya.=20Fixes=20#48325.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://develop.svn.wordpress.org/trunk@49222 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/link-template.php | 2 ++ src/wp-includes/media-template.php | 14 +++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/wp-includes/link-template.php b/src/wp-includes/link-template.php index 9e654aaaeb..519e307764 100644 --- a/src/wp-includes/link-template.php +++ b/src/wp-includes/link-template.php @@ -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. diff --git a/src/wp-includes/media-template.php b/src/wp-includes/media-template.php index c2b87b28af..9908843b98 100644 --- a/src/wp-includes/media-template.php +++ b/src/wp-includes/media-template.php @@ -514,11 +514,19 @@ function wp_print_media_templates() {
- - <# if ( data.can.save ) { #> | + <# if ( data.link ) { #> + + <# } #> + <# if ( data.can.save ) { #> + <# if ( data.link ) { #> + | + <# } #> <# } #> - <# if ( ! data.uploading && data.can.remove ) { #> | + <# if ( ! data.uploading && data.can.remove ) { #> + <# if ( data.link || data.can.save ) { #> + | + <# } #> <# if ( 'trash' === data.status ) { #>