mirror of
https://github.com/WordPress/WordPress.git
synced 2024-09-29 15:47:38 +02:00
Site Icon: For preview fall back to full
size URL when thumbnail
size doesn't exist.
Prevents a JavaScript error for rare cases when cropping is skipped and the image is smaller than `thumbnail`. Merge of [34056] to the 4.3 branch. Props tyxla. See #33417. Built from https://develop.svn.wordpress.org/branches/4.3@34057 git-svn-id: http://core.svn.wordpress.org/branches/4.3@34025 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
2a95fc38b2
commit
b04ce4a437
@ -2163,14 +2163,20 @@
|
||||
* @param {object} attachment
|
||||
*/
|
||||
setImageFromAttachment: function( attachment ) {
|
||||
var icon = typeof attachment.sizes['site_icon-32'] !== 'undefined' ? attachment.sizes['site_icon-32'] : attachment.sizes.thumbnail;
|
||||
var sizes = [ 'site_icon-32', 'thumbnail', 'full' ],
|
||||
icon;
|
||||
|
||||
_.each( sizes, function( size ) {
|
||||
if ( ! icon && ! _.isUndefined ( attachment.sizes[ size ] ) ) {
|
||||
icon = attachment.sizes[ size ];
|
||||
}
|
||||
} );
|
||||
|
||||
this.params.attachment = attachment;
|
||||
|
||||
// Set the Customizer setting; the callback takes care of rendering.
|
||||
this.setting( attachment.id );
|
||||
|
||||
|
||||
// Update the icon in-browser.
|
||||
$( 'link[sizes="32x32"]' ).attr( 'href', icon.url );
|
||||
},
|
||||
|
4
wp-admin/js/customize-controls.min.js
vendored
4
wp-admin/js/customize-controls.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user