From 663d12c8f8acb29fa7d76a7891f42db9cc73d168 Mon Sep 17 00:00:00 2001 From: "Dominik Schilling (ocean90)" Date: Mon, 15 Dec 2014 20:26:54 +0000 Subject: [PATCH] Customizer: Remove date filter from the Header/Background Image upload frames. Adds an option to `wp.media.view.AttachmentsBrowser` to hide the date filter added in [29813]. see #30689. git-svn-id: https://develop.svn.wordpress.org/trunk@30872 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/js/customize-controls.js | 18 +++++++++--------- src/wp-includes/js/media-views.js | 6 +++++- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/wp-admin/js/customize-controls.js b/src/wp-admin/js/customize-controls.js index d721dab1da..db16114b15 100644 --- a/src/wp-admin/js/customize-controls.js +++ b/src/wp-admin/js/customize-controls.js @@ -1060,18 +1060,17 @@ */ initFrame: function() { this.frame = wp.media({ - // The title of the media modal. - title: this.params.button_labels.frame_title, - - // Restrict the library to specified mime type. - library: { - type: this.params.mime_type - }, button: { - // Change the submit button label. text: this.params.button_labels.frame_button }, - multiple: false + states: [ + new wp.media.controller.Library({ + title: this.params.button_labels.frame_title, + library: wp.media.query({ type: this.params.mime_type }), + multiple: false, + date: false + }) + ] }); // When a file is selected, run a callback. @@ -1275,6 +1274,7 @@ title: l10n.chooseImage, library: wp.media.query({ type: 'image' }), multiple: false, + date: false, priority: 20, suggestedWidth: _wpCustomizeHeader.data.width, suggestedHeight: _wpCustomizeHeader.data.height diff --git a/src/wp-includes/js/media-views.js b/src/wp-includes/js/media-views.js index c7e5425318..ffe65f5c79 100644 --- a/src/wp-includes/js/media-views.js +++ b/src/wp-includes/js/media-views.js @@ -2598,6 +2598,7 @@ sortable: state.get('sortable'), search: state.get('searchable'), filters: state.get('filterable'), + date: state.get('date'), display: state.has('display') ? state.get('display') : state.get('displaySettings'), dragInfo: state.get('dragInfo'), @@ -6227,6 +6228,8 @@ * Accepts 'uploaded' and 'all'. * @param {object} [options.search=true] Whether to show the search interface in the * browser's toolbar. + * @param {object} [options.date=true] Whether to show the date filter in the + * browser's toolbar. * @param {object} [options.display=false] Whether to show the attachments display settings * view in the sidebar. * @param {bool|string} [options.sidebar=true] Whether to create a sidebar for the browser. @@ -6240,6 +6243,7 @@ _.defaults( this.options, { filters: false, search: true, + date: true, display: false, sidebar: true, AttachmentView: media.view.Attachment.Library @@ -6453,7 +6457,7 @@ }).render() ); } - } else { + } else if ( this.options.date ) { // DateFilter is a