PluginProbe ʕ •ᴥ•ʔ
Kirki – Freeform Page Builder, Website Builder & Customizer / 6.0.13
Kirki – Freeform Page Builder, Website Builder & Customizer v6.0.13
6.1.1 6.1.0 6.0.14 6.0.13 6.0.12 6.0.11 6.0.10 6.0.9 6.0.8 6.0.7 6.0.6 6.0.5 6.0.4 6.0.3 6.0.2 6.0.1 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 4.0.19 4.0.20 4.0.21 4.0.22 4.0.23 4.0.24 4.1 4.2.0 5.0.0 5.1.0 5.1.1 5.2.0 5.2.1 5.2.2 5.2.3 6.0.0 trunk 3.0.40 3.0.41 3.0.42 3.0.43 3.0.44 3.0.45 3.1.0 3.1.1 3.1.2
kirki / customizer / packages / controls / multicheck / src / Control / Multicheck.php
kirki / customizer / packages / controls / multicheck / src / Control Last commit date
Multicheck.php 3 months ago
Multicheck.php
86 lines
1 <?php
2 /**
3 * Customizer Control: multicheck.
4 *
5 * Multiple checkbox customize control class.
6 * Props @ Justin Tadlock: http://justintadlock.com/archives/2015/05/26/multiple-checkbox-customizer-control
7 *
8 * @package kirki-framework/control-multicheck
9 * @copyright Copyright (c) 2023, Themeum
10 * @license https://opensource.org/licenses/MIT
11 * @since 1.0
12 */
13
14 namespace Kirki\Control;
15
16 use Kirki\Control\Base;
17 use Kirki\URL;
18
19 // Exit if accessed directly.
20 if ( ! defined( 'ABSPATH' ) ) {
21 exit;
22 }
23
24 /**
25 * Adds a multicheck control.
26 *
27 * @since 1.0
28 */
29 class Multicheck extends Base {
30
31 /**
32 * The control type.
33 *
34 * @access public
35 * @since 1.0
36 * @var string
37 */
38 public $type = 'kirki-multicheck';
39
40 /**
41 * The version. Used in scripts & styles for cache-busting.
42 *
43 * @static
44 * @access public
45 * @since 1.0
46 * @var string
47 */
48 public static $control_ver = '1.0';
49
50 /**
51 * Enqueue control related scripts/styles.
52 *
53 * @access public
54 * @since 1.0
55 * @return void
56 */
57
58
59 /**
60 * An Underscore (JS) template for this control's content (but not its container).
61 *
62 * Class variables for this control class are available in the `data` JS object;
63 * export custom variables by overriding {@see WP_Customize_Control::to_json()}.
64 *
65 * @see WP_Customize_Control::print_template()
66 *
67 * @access protected
68 * @since 1.0
69 * @return void
70 */
71 protected function content_template() {
72 ?>
73 <# if ( ! data.choices ) { return; } #>
74
75 <# if ( data.label ) { #><span class="customize-control-title">{{{ data.label }}}</span><# } #>
76 <# if ( data.description ) { #><span class="description customize-control-description">{{{ data.description }}}</span><# } #>
77
78 <ul>
79 <# for ( key in data.choices ) { #>
80 <li><label<# if ( _.contains( data.value, key ) ) { #> class="checked"<# } #>><input {{{ data.inputAttrs }}} type="checkbox" value="{{ key }}"<# if ( _.contains( data.value, key ) ) { #> checked<# } #> />{{ data.choices[ key ] }}</label></li>
81 <# } #>
82 </ul>
83 <?php
84 }
85 }
86