From a3be6f19f098203bc2aae3b9bed2d4a496567d4d Mon Sep 17 00:00:00 2001 From: Richard Aber Date: Mon, 29 Jul 2019 14:28:03 -0500 Subject: [PATCH] Add 'title' shortcode attribute to use on iframe for accessibility Default to 'Embedded PDF Document' if content author does not supply a custom title attribute https://github.com/BenjaminLawson/PDF.js-Viewer-Shortcode/issues/1 --- pdfjs-viewer.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pdfjs-viewer.php b/pdfjs-viewer.php index 04ac595..5e438c3 100644 --- a/pdfjs-viewer.php +++ b/pdfjs-viewer.php @@ -47,6 +47,7 @@ function pdfjs_shortcode_handler( $attr, $content, $tag ) { $attr = shortcode_atts( array( 'url' => '', + 'title' => __( 'Embedded PDF Document', 'pdfjs-viewer-shortcode' ), 'viewer_height' => '1360px', 'viewer_width' => '100%', 'fullscreen' => 'true', @@ -101,11 +102,12 @@ function pdfjs_generator( $attr ) { } return sprintf( - '%1$s', + '%1$s', $fullscreen_link, esc_attr( $attr['viewer_width'] ), esc_attr( $attr['viewer_height'] ), - esc_url( $viewer_url ) + esc_url( $viewer_url ), + esc_attr( $attr['title'] ) ); }