WordPress.org

Make WordPress Core

Changeset 22761


Ignore:
Timestamp:
11/21/2012 02:27:22 PM (8 years ago)
Author:
koopersmith
Message:

Media: Backwards compatibility for the disable_captions filter. see #22186, #21390.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/js/media-upload.js

    r22760 r22761  
    119119
    120120            if ( attachment ) {
    121                 attachment = attachment.toJSON();
    122 
    123121                _.extend( props, {
    124122                    title:   attachment.title || attachment.filename,
     
    154152
    155153            if ( attachment ) {
    156                 attachment = attachment.toJSON();
    157 
    158154                classes.push( 'wp-image-' + attachment.id );
    159155
     
    398394                    delete details[ attachment.cid ];
    399395
    400                     if ( 'image' === attachment.get('type') )
     396                    attachment = attachment.toJSON();
     397
     398                    // If captions are disabled, clear the caption.
     399                    if ( ! wp.media.view.settings.captions )
     400                        delete attachment.caption;
     401
     402                    if ( 'image' === attachment.type )
    401403                        this.insert( wp.media.string.image( detail, attachment ) + ' ' );
    402404                    else
  • trunk/wp-includes/media.php

    r22747 r22761  
    13281328        'tabUrl'    => add_query_arg( array( 'chromeless' => true ), admin_url('media-upload.php') ),
    13291329        'mimeTypes' => wp_list_pluck( get_post_mime_types(), 0 ),
     1330        'captions'  => ! apply_filters( 'disable_captions', '' ),
    13301331    );
    13311332
     
    16921693        </div>
    16931694
    1694         <label class="setting caption">
    1695             <span><?php _e('Caption'); ?></span>
    1696             <textarea data-setting="caption" />
    1697         </label>
     1695        <?php if ( ! apply_filters( 'disable_captions', '' ) ) : ?>
     1696            <label class="setting caption">
     1697                <span><?php _e('Caption'); ?></span>
     1698                <textarea data-setting="caption" />
     1699            </label>
     1700        <?php endif; ?>
    16981701
    16991702        <label class="setting alt-text">
Note: See TracChangeset for help on using the changeset viewer.