aristath/kirki

View on GitHub
packages/kirki-framework/module-preset/src/script.js

Summary

Maintainability
A
0 mins
Test Coverage
/* global kirkiPresetControls */
jQuery( document ).ready( function() {
    _.each( kirkiPresetControls, function( children, parentControl ) {
        wp.customize( parentControl, function( value ) {
            value.bind( function( to ) {
                _.each( children, function( preset, valueToListen ) {
                    if ( valueToListen === to ) {
                        _.each( preset.settings, function( controlValue, controlID ) {
                            wp.customize( controlID ).set( controlValue );
                        } );
                    }
                } );
            } );
        } );
    } );
} );