PluginProbe ʕ •ᴥ•ʔ
Kirki – Freeform Page Builder, Website Builder & Customizer / 6.2.1
Kirki – Freeform Page Builder, Website Builder & Customizer v6.2.1
6.2.1 6.2.0 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 / palette / src / Control / Palette.php
kirki / customizer / packages / controls / palette / src / Control Last commit date
Palette.php 4 months ago
Palette.php
91 lines
1 <?php
2 /**
3 * Customizer Control: palette.
4 *
5 * @package kirki-framework/control-palette
6 * @copyright Copyright (c) 2023, Themeum
7 * @license https://opensource.org/licenses/MIT
8 * @since 1.0
9 */
10
11 namespace Kirki\Control;
12
13 use Kirki\Control\Radio;
14 use Kirki\URL;
15
16 // Exit if accessed directly.
17 if ( ! defined( 'ABSPATH' ) ) {
18 exit;
19 }
20
21 /**
22 * Palette control (modified radio).
23 *
24 * @since 1.0
25 */
26 class Palette extends Radio {
27
28 /**
29 * The control type.
30 *
31 * @access public
32 * @since 1.0
33 * @var string
34 */
35 public $type = 'kirki-palette';
36
37 /**
38 * The version. Used in scripts & styles for cache-busting.
39 *
40 * @static
41 * @access public
42 * @since 1.0
43 * @var string
44 */
45 public static $control_ver = '0.1.1';
46
47 /**
48 * Enqueue control related scripts/styles.
49 *
50 * @access public
51 * @since 1.0
52 * @return void
53 */
54
55
56 /**
57 * An Underscore (JS) template for this control's content (but not its container).
58 *
59 * Class variables for this control class are available in the `data` JS object;
60 * export custom variables by overriding {@see WP_Customize_Control::to_json()}.
61 *
62 * @see WP_Customize_Control::print_template()
63 *
64 * @access protected
65 * @since 1.0
66 * @return void
67 */
68 protected function content_template() {
69 ?>
70 <# if ( ! data.choices ) { return; } #>
71 <span class="customize-control-title">
72 {{{ data.label }}}
73 </span>
74 <# if ( data.description ) { #>
75 <span class="description customize-control-description">{{{ data.description }}}</span>
76 <# } #>
77 <div id="input_{{ data.id }}" class="buttonset">
78 <# for ( key in data.choices ) { #>
79 <input {{{ data.inputAttrs }}} type="radio" value="{{ key }}" name="_customize-palette-{{ data.id }}" id="{{ data.id }}{{ key }}" {{{ data.link }}}<# if ( data.value == key ) { #> checked<# } #>>
80 <label for="{{ data.id }}{{ key }}">
81 <# for ( color in data.choices[ key ] ) { #>
82 <span style='background: {{ data.choices[ key ][ color ] }}'>{{ data.choices[ key ][ color ] }}</span>
83 <# } #>
84 </label>
85 </input>
86 <# } #>
87 </div>
88 <?php
89 }
90 }
91