PluginProbe ʕ •ᴥ•ʔ
Kirki – Freeform Page Builder, Website Builder & Customizer / 6.1.1
Kirki – Freeform Page Builder, Website Builder & Customizer v6.1.1
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 / slider / src / Control / Slider.php
kirki / customizer / packages / controls / slider / src / Control Last commit date
Slider.php 3 months ago
Slider.php
102 lines
1 <?php
2 /**
3 * The slider control.
4 *
5 * Creates a slider control.
6 *
7 * @package kirki-framework/control-slider
8 * @license MIT (https://oss.ninja/mit?organization=Kirki%20Framework)
9 * @since 1.0
10 */
11
12 namespace Kirki\Control;
13
14 use Kirki\Control\Base;
15 use Kirki\URL;
16
17 /**
18 * Slider control.
19 *
20 * @since 1.0
21 */
22 class Slider extends Base {
23
24 /**
25 * The control type.
26 *
27 * @since 1.0
28 * @access public
29 * @var string
30 */
31 public $type = 'kirki-slider';
32
33 /**
34 * The control version.
35 *
36 * @since 1.0
37 * @access public
38 * @var string
39 */
40 public static $control_ver = '1.0.4';
41
42 /**
43 * Enqueue control related styles/scripts.
44 *
45 * @since 1.0
46 * @access public
47 */
48
49
50 /**
51 * Refresh the parameters passed to the JavaScript via JSON.
52 *
53 * @see WP_Customize_Control::to_json()
54 *
55 * @since 1.0
56 * @access public
57 */
58 public function to_json() {
59
60 parent::to_json();
61
62 $this->json['choices'] = wp_parse_args(
63 $this->json['choices'],
64 [
65 'min' => 0,
66 'max' => 100,
67 'step' => 1,
68 ]
69 );
70
71 if ( isset( $this->json['label'] ) ) {
72 $this->json['label'] = html_entity_decode( $this->json['label'] );
73 }
74
75 if ( isset( $this->json['description'] ) ) {
76 $this->json['description'] = html_entity_decode( $this->json['description'] );
77 }
78
79 $this->json['choices']['min'] = (float) $this->json['choices']['min'];
80 $this->json['choices']['max'] = (float) $this->json['choices']['max'];
81 $this->json['choices']['step'] = (float) $this->json['choices']['step'];
82
83 $this->json['value'] = $this->json['value'] < $this->json['choices']['min'] ? $this->json['choices']['min'] : $this->json['value'];
84 $this->json['value'] = $this->json['value'] > $this->json['choices']['max'] ? $this->json['choices']['max'] : $this->json['value'];
85 $this->json['value'] = (float) $this->json['value'];
86
87 }
88
89 /**
90 * An Underscore (JS) template for this control's content (but not its container).
91 *
92 * Class variables for this control class are available in the `data` JS object;
93 * export custom variables by overriding WP_Customize_Control::to_json().
94 *
95 * @see WP_Customize_Control::print_template()
96 *
97 * @since 1.0
98 */
99 protected function content_template() {}
100
101 }
102