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 / tabs / src / Field / Tabs.php
kirki / customizer / packages / controls / tabs / src / Field Last commit date
Tabs.php 5 months ago
Tabs.php
115 lines
1 <?php // phpcs:disable PHPCompatibility.FunctionDeclarations.NewClosure
2 /**
3 * Override field methods
4 *
5 * @package kirki-tabs
6 * @since 1.0
7 */
8
9 namespace Kirki\Field;
10
11 use Kirki\Field;
12
13 /**
14 * Field overrides.
15 *
16 * @since 1.0
17 */
18 class Tabs extends Field {
19
20 /**
21 * The field type.
22 *
23 * @since 1.0
24 * @var string
25 */
26 public $type = 'kirki-tab';
27
28 /**
29 * The control class-name.
30 *
31 * @since 1.0
32 * @var string
33 */
34 protected $control_class = '\Kirki\Control\Tabs';
35
36 /**
37 * Whether we should register the control class for JS-templating or not.
38 *
39 * @access protected
40 * @since 1.0
41 * @var bool
42 */
43 protected $control_has_js_template = true;
44
45 /**
46 * Array of tabs collection.
47 *
48 * @since 1.0.0
49 * @var array
50 */
51 public static $tabs = [];
52
53 /**
54 * Constructor.
55 * Registers any hooks we need to run.
56 *
57 * @since 1.0.0
58 * @param array $args The field arguments.
59 */
60 public function __construct( $args ) {
61
62 parent::__construct( $args );
63
64 self::$tabs[ $args['section'] ] = $args['choices']['tabs'];
65
66 }
67
68 /**
69 * Filter arguments before creating the setting.
70 *
71 * @since 1.0
72 *
73 * @param array $args The field arguments.
74 * @param WP_Customize_Manager $wp_customize The customizer instance.
75 *
76 * @return array
77 */
78 public function filter_setting_args( $args, $wp_customize ) {
79
80 if ( $args['settings'] === $this->args['settings'] ) {
81 $args = parent::filter_setting_args( $args, $wp_customize );
82
83 // Set the sanitize-callback if none is defined.
84 if ( ! isset( $args['sanitize_callback'] ) || ! $args['sanitize_callback'] ) {
85 $args['sanitize_callback'] = '__return_null';
86 }
87 }
88
89 return $args;
90
91 }
92
93 /**
94 * Filter arguments before creating the control.
95 *
96 * @since 0.1
97 *
98 * @param array $args The field arguments.
99 * @param WP_Customize_Manager $wp_customize The customizer instance.
100 *
101 * @return array
102 */
103 public function filter_control_args( $args, $wp_customize ) {
104
105 if ( $args['settings'] === $this->args['settings'] ) {
106 $args = parent::filter_control_args( $args, $wp_customize );
107 $args['type'] = 'kirki-tab';
108 }
109
110 return $args;
111
112 }
113 }
114
115