Issues (377)

field/class-kirki-field-switch.php (1 issue)

1
<?php
2
/**
3
 * Override field methods
4
 *
5
 * @package     Kirki
6
 * @subpackage  Controls
7
 * @copyright   Copyright (c) 2017, Aristeides Stathopoulos
8
 * @license    https://opensource.org/licenses/MIT
9
 * @since       2.2.7
10
 */
11
12
/**
13
 * Field overrides.
14
 */
15
class Kirki_Field_Switch extends Kirki_Field_Checkbox {
16
17
	/**
18
	 * Sets the control type.
19
	 *
20
	 * @access protected
21
	 */
22
	protected function set_type() {
23
		$this->type = 'kirki-switch';
24
	}
25
26
	/**
27
	 * Sets the control choices.
28
	 *
29
	 * @access protected
30
	 */
31
	protected function set_choices() {
32
		if ( ! is_array( $this->choices ) ) {
0 ignored issues
show
The condition is_array($this->choices) is always true.
Loading history...
33
			$this->choices = array();
34
		}
35
36
		$this->choices = wp_parse_args(
37
			$this->choices,
38
			array(
39
				'on'    => esc_html__( 'On', 'kirki' ),
40
				'off'   => esc_html__( 'Off', 'kirki' ),
41
				'round' => false,
42
			)
43
		);
44
	}
45
}
46