HEX
Server: Apache/2
System: Linux chaudang 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User: mgawa (1021)
PHP: 7.3.33
Disabled: NONE
Upload Files
File: /home/mgawa/public_html/wp-content/themes/flatsome/inc/admin/kirki/modules/preset/preset.js
/* global kirkiSetSettingValue */
jQuery( document ).ready( function() {

	// Loop Controls.
	wp.customize.control.each( function( control ) {

		// Check if we have a preset defined.
		if ( control.params && control.params.preset && ! _.isEmpty( control.params.preset ) ) {
			wp.customize( control.id, function( value ) {

				// Listen to value changes.
				value.bind( function( to ) {

					// Loop preset definitions.
					_.each( control.params.preset, function( preset, valueToListen ) {

						// Check if the value set want is the same as the one we're looking for.
						if ( valueToListen === to ) {

							// Loop settings defined inside the preset.
							_.each( preset.settings, function( controlValue, controlID ) {

								// Set the value.
								kirkiSetSettingValue.set( controlID, controlValue );
							} );
						}
					} );
				} );
			} );
		}
	} );
} );