Completed
Pull Request — develop (#1319)
by Aristeides
02:28
created

Kirki_Sections_Nested_Section   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 47
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 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
	public function json() {
36
37
		$array = wp_array_slice_assoc( (array) $this, array(
38
			'id',
39
			'description',
40
			'priority',
41
			'panel',
42
			'type',
43
			'description_hidden',
44
			'section',
45
		));
46
47
		$array['title']          = html_entity_decode( $this->title, ENT_QUOTES, get_bloginfo( 'charset' ) );
48
		$array['content']        = $this->get_content();
49
		$array['active']         = $this->active();
50
		$array['instanceNumber'] = $this->instance_number;
51
52
		$array['customizeAction'] = esc_attr__( 'Customizing', 'kirki' );
53
		if ( $this->panel ) {
54
			$array['customizeAction'] = sprintf(
55
				esc_attr__( 'Customizing &#9656; %s', 'kirki' ),
56
				esc_html( $this->manager->get_panel( $this->panel )->title )
57
			);
58
		}
59
		return $array;
60
	}
61
}
62