From e7c286551f2b84c91d0d36f8842160901922d88a Mon Sep 17 00:00:00 2001 From: Konstantin Obenland Date: Fri, 3 Jul 2015 21:27:06 +0000 Subject: [PATCH] Site Icon: Remove date dropdown from media modal. This also allows us to leverage the builtin `suggestedWidth` and `suggestedHeight` parameters to convey the expected image size. Props ocean90. Fixes #32860. git-svn-id: https://develop.svn.wordpress.org/trunk@33075 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/class-wp-site-icon.php | 2 +- src/wp-admin/js/site-icon.js | 23 ++++++++++---------- src/wp-admin/options-general.php | 4 ++-- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/wp-admin/includes/class-wp-site-icon.php b/src/wp-admin/includes/class-wp-site-icon.php index 147ccc9440..c397457dc2 100644 --- a/src/wp-admin/includes/class-wp-site-icon.php +++ b/src/wp-admin/includes/class-wp-site-icon.php @@ -176,7 +176,7 @@ class WP_Site_Icon { ?>

- +

diff --git a/src/wp-admin/js/site-icon.js b/src/wp-admin/js/site-icon.js index 2328d529f6..1f31f312fd 100644 --- a/src/wp-admin/js/site-icon.js +++ b/src/wp-admin/js/site-icon.js @@ -3,7 +3,7 @@ $( function() { // Build the choose from library frame. - $( '#choose-from-library-link' ).click( function( event ) { + $( '#choose-from-library-link' ).on( 'click', function( event ) { var $el = $(this); event.preventDefault(); @@ -14,15 +14,7 @@ } // Create the media frame. - frame = wp.media.frames.customHeader = wp.media({ - // Set the title of the modal. - title: $el.data('choose'), - - // Tell the modal to show only images. - library: { - type: 'image' - }, - + frame = wp.media({ // Customize the submit button. button: { // Set the text of the button. @@ -30,7 +22,16 @@ // Tell the button not to close the modal, since we're // going to refresh the page when the image is selected. close: false - } + }, + states: [ + new wp.media.controller.Library({ + title: $el.data( 'choose' ), + library: wp.media.query({ type: 'image' }), + date: false, + suggestedWidth: $el.data( 'size' ), + suggestedHeight: $el.data( 'size' ) + }) + ] }); // When an image is selected, run a callback. diff --git a/src/wp-admin/options-general.php b/src/wp-admin/options-general.php index b8175fbb09..21f568fc43 100644 --- a/src/wp-admin/options-general.php +++ b/src/wp-admin/options-general.php @@ -146,7 +146,7 @@ include( ABSPATH . 'wp-admin/admin-header.php' );

- +

@@ -158,7 +158,7 @@ include( ABSPATH . 'wp-admin/admin-header.php' );

- +