1 | <?php |
||
22 | class Kirki_Control_Gradient extends WP_Customize_Control { |
||
23 | |||
24 | /** |
||
25 | * The control type. |
||
26 | * |
||
27 | * @access public |
||
28 | * @var string |
||
29 | */ |
||
30 | public $type = 'kirki-gradient'; |
||
31 | |||
32 | /** |
||
33 | * Colorpicker palette |
||
34 | * |
||
35 | * @access public |
||
36 | * @var bool |
||
37 | */ |
||
38 | public $palette = true; |
||
39 | |||
40 | /** |
||
41 | * Used to automatically generate all CSS output. |
||
42 | * |
||
43 | * @access public |
||
44 | * @var array |
||
45 | */ |
||
46 | public $output = array(); |
||
47 | |||
48 | /** |
||
49 | * Data type |
||
50 | * |
||
51 | * @access public |
||
52 | * @var string |
||
53 | */ |
||
54 | public $option_type = 'theme_mod'; |
||
55 | |||
56 | /** |
||
57 | * The kirki_config we're using for this control |
||
58 | * |
||
59 | * @access public |
||
60 | * @var string |
||
61 | */ |
||
62 | public $kirki_config = 'global'; |
||
63 | |||
64 | /** |
||
65 | * Constructor. |
||
66 | * |
||
67 | * Supplied `$args` override class property defaults. |
||
68 | * |
||
69 | * If `$args['settings']` is not defined, use the $id as the setting ID. |
||
70 | * |
||
71 | * @since 3.0.0 |
||
72 | * |
||
73 | * @param WP_Customize_Manager $manager Customizer bootstrap instance. |
||
74 | * @param string $id Control ID. |
||
75 | * @param array $args { |
||
76 | * Optional. Arguments to override class property defaults. |
||
77 | * |
||
78 | * @type int $instance_number Order in which this instance was created in relation |
||
79 | * to other instances. |
||
80 | * @type WP_Customize_Manager $manager Customizer bootstrap instance. |
||
81 | * @type string $id Control ID. |
||
82 | * @type array $settings All settings tied to the control. If undefined, `$id` will |
||
83 | * be used. |
||
84 | * @type string $setting The primary setting for the control (if there is one). |
||
85 | * Default 'default'. |
||
86 | * @type int $priority Order priority to load the control. Default 10. |
||
87 | * @type string $section Section the control belongs to. Default empty. |
||
88 | * @type string $label Label for the control. Default empty. |
||
89 | * @type string $description Description for the control. Default empty. |
||
90 | * @type array $choices List of choices for 'radio' or 'select' type controls, where |
||
91 | * values are the keys, and labels are the values. |
||
92 | * Default empty array. |
||
93 | * @type array $input_attrs List of custom input attributes for control output, where |
||
94 | * attribute names are the keys and values are the values. Not |
||
95 | * used for 'checkbox', 'radio', 'select', 'textarea', or |
||
96 | * 'dropdown-pages' control types. Default empty array. |
||
97 | * @type array $json Deprecated. Use WP_Customize_Control::json() instead. |
||
98 | * @type string $type Control type. Core controls include 'text', 'checkbox', |
||
99 | * 'textarea', 'radio', 'select', and 'dropdown-pages'. Additional |
||
100 | * input types such as 'email', 'url', 'number', 'hidden', and |
||
101 | * 'date' are supported implicitly. Default 'text'. |
||
102 | * } |
||
103 | */ |
||
104 | public function __construct( $manager, $id, $args = array() ) { |
||
110 | |||
111 | /** |
||
112 | * Refresh the parameters passed to the JavaScript via JSON. |
||
113 | * |
||
114 | * @access public |
||
115 | */ |
||
116 | public function to_json() { |
||
137 | |||
138 | /** |
||
139 | * Enqueue control related scripts/styles. |
||
140 | * |
||
141 | * @access public |
||
142 | */ |
||
143 | public function enqueue_scripts() { |
||
159 | |||
160 | /** |
||
161 | * An Underscore (JS) template for this control's content (but not its container). |
||
162 | * |
||
163 | * Class variables for this control class are available in the `data` JS object; |
||
164 | * export custom variables by overriding {@see WP_Customize_Control::to_json()}. |
||
165 | * |
||
166 | * @see WP_Customize_Control::print_template() |
||
167 | * |
||
168 | * @access protected |
||
169 | */ |
||
170 | protected function content_template() { |
||
221 | } |
||
222 |