Make WordPress Core

Changeset 47776


Ignore:
Timestamp:
05/08/2020 07:34:14 PM (5 years ago)
Author:
ianbelanger
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentytwenty/assets/js/customize-controls.js

    r46827 r47776  
    3434                    twentyTwentySetAccessibleColorsValue( context, to, wp.customize( 'accent_hue' ).get(), to );
    3535                } );
     36            } );
     37        } );
     38
     39        // Show or hide retina_logo setting on the first load.
     40        twentyTwentySetRetineLogoVisibility( !! wp.customize( 'custom_logo' )() );
     41
     42        // Add a listener for custom_logo changes.
     43        wp.customize( 'custom_logo', function( value ) {
     44            value.bind( function( to ) {
     45                // Show or hide retina_logo setting on changing custom_logo.
     46                twentyTwentySetRetineLogoVisibility( !! to );
    3647            } );
    3748        } );
     
    8899        wp.customize( 'accent_accessible_colors' )._dirty = true;
    89100    }
     101
     102    /**
     103     * Shows or hides the "retina_logo" setting based on the given value.
     104     *
     105     * @since Twenty Twenty 1.3
     106     *
     107     * @param {boolean} visible The visible value.
     108     *
     109     * @return {void}
     110     */
     111    function twentyTwentySetRetineLogoVisibility( visible ) {
     112        wp.customize.control( 'retina_logo' ).container.toggle( visible );
     113    }
    90114}( jQuery ) );
Note: See TracChangeset for help on using the changeset viewer.