Widgets: Supply missing descriptions for instance schema fields in media widgets.

Reuse translated strings from media templates.

Amends [40640].
See #32417.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40686 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter 2017-05-25 02:59:44 +00:00
parent a8309f80c3
commit 8307924de6
4 changed files with 18 additions and 2 deletions

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.8-beta2-40834'; $wp_version = '4.8-beta2-40835';
/** /**
* 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.

View File

@ -64,10 +64,12 @@ class WP_Widget_Media_Audio extends WP_Widget_Media {
'type' => 'string', 'type' => 'string',
'enum' => array( 'none', 'auto', 'metadata' ), 'enum' => array( 'none', 'auto', 'metadata' ),
'default' => 'none', 'default' => 'none',
'description' => __( 'Preload' ),
), ),
'loop' => array( 'loop' => array(
'type' => 'boolean', 'type' => 'boolean',
'default' => false, 'default' => false,
'description' => __( 'Loop' ),
), ),
) )
); );

View File

@ -63,34 +63,40 @@ class WP_Widget_Media_Image extends WP_Widget_Media {
'type' => 'string', 'type' => 'string',
'enum' => array_merge( get_intermediate_image_sizes(), array( 'full', 'custom' ) ), 'enum' => array_merge( get_intermediate_image_sizes(), array( 'full', 'custom' ) ),
'default' => 'medium', 'default' => 'medium',
'description' => __( 'Size' ),
), ),
'width' => array( // Via 'customWidth', only when size=custom; otherwise via 'width'. 'width' => array( // Via 'customWidth', only when size=custom; otherwise via 'width'.
'type' => 'integer', 'type' => 'integer',
'minimum' => 0, 'minimum' => 0,
'default' => 0, 'default' => 0,
'description' => __( 'Width' ),
), ),
'height' => array( // Via 'customHeight', only when size=custom; otherwise via 'height'. 'height' => array( // Via 'customHeight', only when size=custom; otherwise via 'height'.
'type' => 'integer', 'type' => 'integer',
'minimum' => 0, 'minimum' => 0,
'default' => 0, 'default' => 0,
'description' => __( 'Height' ),
), ),
'caption' => array( 'caption' => array(
'type' => 'string', 'type' => 'string',
'default' => '', 'default' => '',
'sanitize_callback' => 'wp_kses_post', 'sanitize_callback' => 'wp_kses_post',
'description' => __( 'Caption' ),
'should_preview_update' => false, 'should_preview_update' => false,
), ),
'alt' => array( 'alt' => array(
'type' => 'string', 'type' => 'string',
'default' => '', 'default' => '',
'sanitize_callback' => 'sanitize_text_field', 'sanitize_callback' => 'sanitize_text_field',
'description' => __( 'Alternative Text' ),
), ),
'link_type' => array( 'link_type' => array(
'type' => 'string', 'type' => 'string',
'enum' => array( 'none', 'file', 'post', 'custom' ), 'enum' => array( 'none', 'file', 'post', 'custom' ),
'default' => 'none', 'default' => 'none',
'media_prop' => 'link', 'media_prop' => 'link',
'description' => __( 'Link To' ),
'should_preview_update' => false, 'should_preview_update' => false,
), ),
'link_url' => array( 'link_url' => array(
@ -98,6 +104,7 @@ class WP_Widget_Media_Image extends WP_Widget_Media {
'default' => '', 'default' => '',
'format' => 'uri', 'format' => 'uri',
'media_prop' => 'linkUrl', 'media_prop' => 'linkUrl',
'description' => __( 'URL' ),
'should_preview_update' => false, 'should_preview_update' => false,
), ),
'image_classes' => array( 'image_classes' => array(
@ -105,6 +112,7 @@ class WP_Widget_Media_Image extends WP_Widget_Media {
'default' => '', 'default' => '',
'sanitize_callback' => array( $this, 'sanitize_token_list' ), 'sanitize_callback' => array( $this, 'sanitize_token_list' ),
'media_prop' => 'extraClasses', 'media_prop' => 'extraClasses',
'description' => __( 'Image CSS Class' ),
'should_preview_update' => false, 'should_preview_update' => false,
), ),
'link_classes' => array( 'link_classes' => array(
@ -113,18 +121,21 @@ class WP_Widget_Media_Image extends WP_Widget_Media {
'sanitize_callback' => array( $this, 'sanitize_token_list' ), 'sanitize_callback' => array( $this, 'sanitize_token_list' ),
'media_prop' => 'linkClassName', 'media_prop' => 'linkClassName',
'should_preview_update' => false, 'should_preview_update' => false,
'description' => __( 'Link CSS Class' ),
), ),
'link_rel' => array( 'link_rel' => array(
'type' => 'string', 'type' => 'string',
'default' => '', 'default' => '',
'sanitize_callback' => array( $this, 'sanitize_token_list' ), 'sanitize_callback' => array( $this, 'sanitize_token_list' ),
'media_prop' => 'linkRel', 'media_prop' => 'linkRel',
'description' => __( 'Link Rel' ),
'should_preview_update' => false, 'should_preview_update' => false,
), ),
'link_target_blank' => array( // Via 'linkTargetBlank' property. 'link_target_blank' => array(
'type' => 'boolean', 'type' => 'boolean',
'default' => false, 'default' => false,
'media_prop' => 'linkTargetBlank', 'media_prop' => 'linkTargetBlank',
'description' => __( 'Open link in a new tab' ),
'should_preview_update' => false, 'should_preview_update' => false,
), ),
'image_title' => array( 'image_title' => array(
@ -132,6 +143,7 @@ class WP_Widget_Media_Image extends WP_Widget_Media {
'default' => '', 'default' => '',
'sanitize_callback' => 'sanitize_text_field', 'sanitize_callback' => 'sanitize_text_field',
'media_prop' => 'title', 'media_prop' => 'title',
'description' => __( 'Image Title Attribute' ),
'should_preview_update' => false, 'should_preview_update' => false,
), ),

View File

@ -65,11 +65,13 @@ class WP_Widget_Media_Video extends WP_Widget_Media {
'type' => 'string', 'type' => 'string',
'enum' => array( 'none', 'auto', 'metadata' ), 'enum' => array( 'none', 'auto', 'metadata' ),
'default' => 'metadata', 'default' => 'metadata',
'description' => __( 'Preload' ),
'should_preview_update' => false, 'should_preview_update' => false,
), ),
'loop' => array( 'loop' => array(
'type' => 'boolean', 'type' => 'boolean',
'default' => false, 'default' => false,
'description' => __( 'Loop' ),
'should_preview_update' => false, 'should_preview_update' => false,
), ),
'content' => array( 'content' => array(