WordPress.org

Make WordPress Core

Changeset 28990


Ignore:
Timestamp:
07/04/2014 02:02:16 AM (5 years ago)
Author:
wonderboymusic
Message:

Allow users to override default gallery settings in JS via wp_localize_script(). This is already possible in PHP by filtering shortcode_atts_gallery.

Fixes #28693.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/js/media-editor.js

    r28752 r28990  
    578578    };
    579579
     580    wp.media.galleryDefaults = {
     581        itemtag: 'dl',
     582        icontag: 'dt',
     583        captiontag: 'dd',
     584        columns: '3',
     585        link: 'post',
     586        size: 'thumbnail',
     587        order: 'ASC',
     588        id: wp.media.view.settings.post && wp.media.view.settings.post.id,
     589        orderby : 'menu_order ID'
     590    };
     591
     592    if ( wp.media.view.settings.galleryDefaults ) {
     593        _.extend( wp.media.galleryDefaults, wp.media.view.settings.galleryDefaults );
     594    }
     595
    580596    wp.media.gallery = new wp.media.collection({
    581597        tag: 'gallery',
    582598        type : 'image',
    583599        editTitle : wp.media.view.l10n.editGalleryTitle,
    584         defaults : {
    585             itemtag: 'dl',
    586             icontag: 'dt',
    587             captiontag: 'dd',
    588             columns: '3',
    589             link: 'post',
    590             size: 'thumbnail',
    591             order: 'ASC',
    592             id: wp.media.view.settings.post && wp.media.view.settings.post.id,
    593             orderby : 'menu_order ID'
    594         }
     600        defaults : wp.media.galleryDefaults
    595601    });
    596602
Note: See TracChangeset for help on using the changeset viewer.