Bundled Themes: Twenty Twenty customizer retina_logo should be hidden when no logo is set.

Modifies the Customize setting `Site Identity > Retina logo` so that the option is hidden if there is no logo is set in `Site Identity > Logo`.

Props truongwp.
Fixes #50109.

git-svn-id: https://develop.svn.wordpress.org/trunk@47776 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ian Belanger 2020-05-08 19:34:14 +00:00
parent 24b71985b8
commit e6547ba815

View File

@ -35,6 +35,17 @@
} );
} );
} );
// Show or hide retina_logo setting on the first load.
twentyTwentySetRetineLogoVisibility( !! wp.customize( 'custom_logo' )() );
// Add a listener for custom_logo changes.
wp.customize( 'custom_logo', function( value ) {
value.bind( function( to ) {
// Show or hide retina_logo setting on changing custom_logo.
twentyTwentySetRetineLogoVisibility( !! to );
} );
} );
} );
/**
@ -87,4 +98,17 @@
// Small hack to save the option.
wp.customize( 'accent_accessible_colors' )._dirty = true;
}
/**
* Shows or hides the "retina_logo" setting based on the given value.
*
* @since Twenty Twenty 1.3
*
* @param {boolean} visible The visible value.
*
* @return {void}
*/
function twentyTwentySetRetineLogoVisibility( visible ) {
wp.customize.control( 'retina_logo' ).container.toggle( visible );
}
}( jQuery ) );