Kirki_Field_Spacing::set_choices()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 12
nc 1
nop 0
dl 0
loc 17
rs 9.8666
c 1
b 0
f 0
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_Spacing extends Kirki_Field_Dimensions {
16
17
	/**
18
	 * Set the choices.
19
	 * Adds a pseudo-element "controls" that helps with the JS API.
20
	 *
21
	 * @access protected
22
	 */
23
	protected function set_choices() {
24
		$default_args = array(
25
			'controls' => array(
26
				'top'    => ( isset( $this->default['top'] ) ),
27
				'bottom' => ( isset( $this->default['top'] ) ),
28
				'left'   => ( isset( $this->default['top'] ) ),
29
				'right'  => ( isset( $this->default['top'] ) ),
30
			),
31
			'labels'   => array(
32
				'top'    => esc_html__( 'Top', 'kirki' ),
33
				'bottom' => esc_html__( 'Bottom', 'kirki' ),
34
				'left'   => esc_html__( 'Left', 'kirki' ),
35
				'right'  => esc_html__( 'Right', 'kirki' ),
36
			),
37
		);
38
39
		$this->choices = wp_parse_args( $this->choices, $default_args );
40
	}
41
}
42