From 1e63cdcf38a1926de3c574fd25c521cf12cbfe59 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Thu, 25 May 2017 02:58:21 +0000 Subject: [PATCH] Widgets: Supply missing descriptions for instance schema fields in media widgets. Reuse translated strings from media templates. Amends [40640]. See #32417. git-svn-id: https://develop.svn.wordpress.org/trunk@40835 602fd350-edb4-49c9-b593-d223f7449a82 --- .../widgets/class-wp-widget-media-audio.php | 2 ++ .../widgets/class-wp-widget-media-image.php | 14 +++++++++++++- .../widgets/class-wp-widget-media-video.php | 2 ++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/widgets/class-wp-widget-media-audio.php b/src/wp-includes/widgets/class-wp-widget-media-audio.php index 569b620b0d..c6f8c53e9e 100644 --- a/src/wp-includes/widgets/class-wp-widget-media-audio.php +++ b/src/wp-includes/widgets/class-wp-widget-media-audio.php @@ -64,10 +64,12 @@ class WP_Widget_Media_Audio extends WP_Widget_Media { 'type' => 'string', 'enum' => array( 'none', 'auto', 'metadata' ), 'default' => 'none', + 'description' => __( 'Preload' ), ), 'loop' => array( 'type' => 'boolean', 'default' => false, + 'description' => __( 'Loop' ), ), ) ); diff --git a/src/wp-includes/widgets/class-wp-widget-media-image.php b/src/wp-includes/widgets/class-wp-widget-media-image.php index 1998ff0c7c..63e3ef685f 100644 --- a/src/wp-includes/widgets/class-wp-widget-media-image.php +++ b/src/wp-includes/widgets/class-wp-widget-media-image.php @@ -63,34 +63,40 @@ class WP_Widget_Media_Image extends WP_Widget_Media { 'type' => 'string', 'enum' => array_merge( get_intermediate_image_sizes(), array( 'full', 'custom' ) ), 'default' => 'medium', + 'description' => __( 'Size' ), ), 'width' => array( // Via 'customWidth', only when size=custom; otherwise via 'width'. 'type' => 'integer', 'minimum' => 0, 'default' => 0, + 'description' => __( 'Width' ), ), 'height' => array( // Via 'customHeight', only when size=custom; otherwise via 'height'. 'type' => 'integer', 'minimum' => 0, 'default' => 0, + 'description' => __( 'Height' ), ), 'caption' => array( 'type' => 'string', 'default' => '', 'sanitize_callback' => 'wp_kses_post', + 'description' => __( 'Caption' ), 'should_preview_update' => false, ), 'alt' => array( 'type' => 'string', 'default' => '', 'sanitize_callback' => 'sanitize_text_field', + 'description' => __( 'Alternative Text' ), ), 'link_type' => array( 'type' => 'string', 'enum' => array( 'none', 'file', 'post', 'custom' ), 'default' => 'none', 'media_prop' => 'link', + 'description' => __( 'Link To' ), 'should_preview_update' => false, ), 'link_url' => array( @@ -98,6 +104,7 @@ class WP_Widget_Media_Image extends WP_Widget_Media { 'default' => '', 'format' => 'uri', 'media_prop' => 'linkUrl', + 'description' => __( 'URL' ), 'should_preview_update' => false, ), 'image_classes' => array( @@ -105,6 +112,7 @@ class WP_Widget_Media_Image extends WP_Widget_Media { 'default' => '', 'sanitize_callback' => array( $this, 'sanitize_token_list' ), 'media_prop' => 'extraClasses', + 'description' => __( 'Image CSS Class' ), 'should_preview_update' => false, ), 'link_classes' => array( @@ -113,18 +121,21 @@ class WP_Widget_Media_Image extends WP_Widget_Media { 'sanitize_callback' => array( $this, 'sanitize_token_list' ), 'media_prop' => 'linkClassName', 'should_preview_update' => false, + 'description' => __( 'Link CSS Class' ), ), 'link_rel' => array( 'type' => 'string', 'default' => '', 'sanitize_callback' => array( $this, 'sanitize_token_list' ), 'media_prop' => 'linkRel', + 'description' => __( 'Link Rel' ), 'should_preview_update' => false, ), - 'link_target_blank' => array( // Via 'linkTargetBlank' property. + 'link_target_blank' => array( 'type' => 'boolean', 'default' => false, 'media_prop' => 'linkTargetBlank', + 'description' => __( 'Open link in a new tab' ), 'should_preview_update' => false, ), 'image_title' => array( @@ -132,6 +143,7 @@ class WP_Widget_Media_Image extends WP_Widget_Media { 'default' => '', 'sanitize_callback' => 'sanitize_text_field', 'media_prop' => 'title', + 'description' => __( 'Image Title Attribute' ), 'should_preview_update' => false, ), diff --git a/src/wp-includes/widgets/class-wp-widget-media-video.php b/src/wp-includes/widgets/class-wp-widget-media-video.php index 5816286e06..dd90bfac6b 100644 --- a/src/wp-includes/widgets/class-wp-widget-media-video.php +++ b/src/wp-includes/widgets/class-wp-widget-media-video.php @@ -65,11 +65,13 @@ class WP_Widget_Media_Video extends WP_Widget_Media { 'type' => 'string', 'enum' => array( 'none', 'auto', 'metadata' ), 'default' => 'metadata', + 'description' => __( 'Preload' ), 'should_preview_update' => false, ), 'loop' => array( 'type' => 'boolean', 'default' => false, + 'description' => __( 'Loop' ), 'should_preview_update' => false, ), 'content' => array(