Completed
Pull Request — develop (#1319)
by Aristeides
03:53 queued 01:19
created

Kirki_Sections_Nested_Section   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 54
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B json() 0 26 2
1
<?php
2
/**
3
 * Nested section.
4
 *
5
 * @package     Kirki
6
 * @subpackage  Custom Sections Module
7
 * @copyright   Copyright (c) 2016, Aristeides Stathopoulos
8
 * @license     http://opensource.org/licenses/https://opensource.org/licenses/MIT
9
 * @since       2.2.0
10
 */
11
12
/**
13
 * Nested section.
14
 */
15
class Kirki_Sections_Nested_Section extends WP_Customize_Section {
16
17
	/**
18
	 * The parent section.
19
	 *
20
	 * @access public
21
	 * @since 3.0.0
22
	 * @var string
23
	 */
24
	public $section;
25
26
	/**
27
	 * The section type.
28
	 *
29
	 * @access public
30
	 * @since 3.0.0
31
	 * @var string
32
	 */
33
	public $type = 'kirki-nested';
34
35
	/**
36
	 * Gather the parameters passed to client JavaScript via JSON.
37
	 *
38
	 * @access public
39
	 * @since 3.0.0
40
	 * @return array The array to be exported to the client as JSON.
41
	 */
42
	public function json() {
43
44
		$array = wp_array_slice_assoc( (array) $this, array(
45
			'id',
46
			'description',
47
			'priority',
48
			'panel',
49
			'type',
50
			'description_hidden',
51
			'section',
52
		));
53
54
		$array['title']          = html_entity_decode( $this->title, ENT_QUOTES, get_bloginfo( 'charset' ) );
55
		$array['content']        = $this->get_content();
56
		$array['active']         = $this->active();
57
		$array['instanceNumber'] = $this->instance_number;
58
59
		$array['customizeAction'] = esc_attr__( 'Customizing', 'kirki' );
60
		if ( $this->panel ) {
61
			$array['customizeAction'] = sprintf(
62
				esc_attr__( 'Customizing &#9656; %s', 'kirki' ),
63
				esc_html( $this->manager->get_panel( $this->panel )->title )
64
			);
65
		}
66
		return $array;
67
	}
68
}
69