Make WordPress Core


Ignore:
Timestamp:
08/14/2017 05:55:24 PM (9 years ago)
Author:
westonruter
Message:

Widgets: Expose link URL input field in Image widget to avoid having to open media modal to discover.

Props timmydcrawford, westonruter.
See #39993.
Fixes #41274.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/widgets/class-wp-widget-media-image.php

    r41162 r41252  
    9696                                        'media_prop' => 'link',
    9797                                        'description' => __( 'Link To' ),
    98                                         'should_preview_update' => false,
     98                                        'should_preview_update' => true,
    9999                                ),
    100100                                'link_url' => array(
     
    104104                                        'media_prop' => 'linkUrl',
    105105                                        'description' => __( 'URL' ),
    106                                         'should_preview_update' => false,
     106                                        'should_preview_update' => true,
    107107                                ),
    108108                                'image_classes' => array(
     
    308308
    309309                ?>
     310                <script type="text/html" id="tmpl-wp-media-widget-image-fields">
     311                        <# var elementIdPrefix = 'el' + String( Math.random() ) + '_'; #>
     312                        <# if ( data.url ) { #>
     313                        <p class="media-widget-image-link">
     314                                <label for="{{ elementIdPrefix }}linkUrl"><?php esc_html_e( 'Link to:' ); ?></label>
     315                                <input id="{{ elementIdPrefix }}linkUrl" type="url" class="widefat link" value="{{ data.link_url }}" placeholder="http://">
     316                        </p>
     317                        <# } #>
     318                </script>
    310319                <script type="text/html" id="tmpl-wp-media-widget-image-preview">
    311                         <#
    312                         var describedById = 'describedBy-' + String( Math.random() );
    313                         #>
     320                        <# var describedById = 'describedBy-' + String( Math.random() ); #>
    314321                        <# if ( data.error && 'missing_attachment' === data.error ) { #>
    315322                                <div class="notice notice-error notice-alt notice-missing-attachment">
Note: See TracChangeset for help on using the changeset viewer.