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 / custom / src / Field / Custom.php
kirki / customizer / packages / controls / custom / src / Field Last commit date
Custom.php 5 months ago
Custom.php
85 lines
1 <?php
2 /**
3 * Override field methods when used with the Kirki API.
4 *
5 * @package kirki-framework/control-custom
6 * @copyright Copyright (c) 2023, Themeum
7 * @license https://opensource.org/licenses/MIT
8 * @since 1.0
9 */
10
11 namespace Kirki\Field;
12
13 use Kirki\Field;
14
15 /**
16 * Field overrides.
17 *
18 * @since 1.0
19 */
20 class Custom extends Field {
21
22 /**
23 * The field type.
24 *
25 * @access public
26 * @since 1.0
27 * @var string
28 */
29 public $type = 'kirki-custom';
30
31 /**
32 * The control class-name.
33 *
34 * @access protected
35 * @since 0.1
36 * @var string
37 */
38 protected $control_class = '\Kirki\Control\Custom';
39
40 /**
41 * Whether we should register the control class for JS-templating or not.
42 *
43 * @access protected
44 * @since 0.1
45 * @var bool
46 */
47 protected $control_has_js_template = true;
48
49 /**
50 * Filter arguments before creating the setting.
51 *
52 * @access public
53 * @since 0.1
54 * @param array $args The field arguments.
55 * @param WP_Customize_Manager $wp_customize The customizer instance.
56 * @return array
57 */
58 public function filter_setting_args( $args, $wp_customize ) {
59 if ( $args['settings'] === $this->args['settings'] ) {
60 $args = parent::filter_setting_args( $args, $wp_customize );
61 if ( ! isset( $args['sanitize_callback'] ) || ! $args['sanitize_callback'] ) {
62 $args['sanitize_callback'] = '__return_null';
63 }
64 }
65 return $args;
66 }
67
68 /**
69 * Filter arguments before creating the control.
70 *
71 * @access public
72 * @since 0.1
73 * @param array $args The field arguments.
74 * @param WP_Customize_Manager $wp_customize The customizer instance.
75 * @return array
76 */
77 public function filter_control_args( $args, $wp_customize ) {
78 if ( $args['settings'] === $this->args['settings'] ) {
79 $args = parent::filter_control_args( $args, $wp_customize );
80 $args['type'] = 'kirki-custom';
81 }
82 return $args;
83 }
84 }
85