| Total Complexity | 4 |
| Complexity/F | 1.33 |
| Lines of Code | 24 |
| Function Count | 3 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | wp.customize.controlConstructor['kirki-multicheck'] = wp.customize.kirkiDynamicControl.extend({ |
||
| 2 | |||
| 3 | initKirkiControl: function() { |
||
| 4 | |||
| 5 | var control = this; |
||
| 6 | |||
| 7 | // Save the value |
||
| 8 | control.container.on( 'change', 'input', function() { |
||
| 9 | var value = [], |
||
| 10 | i = 0; |
||
| 11 | |||
| 12 | // Build the value as an object using the sub-values from individual checkboxes. |
||
| 13 | jQuery.each( control.params.choices, function( key ) { |
||
| 14 | if ( control.container.find( 'input[value="' + key + '"]' ).is( ':checked' ) ) { |
||
| 15 | value[ i ] = key; |
||
| 16 | i++; |
||
| 17 | } |
||
| 18 | }); |
||
| 19 | |||
| 20 | // Update the value in the customizer. |
||
| 21 | control.setting.set( value ); |
||
| 22 | }); |
||
| 23 | } |
||
| 24 | }); |
||
| 25 |