1<?php
2/**
3 * Customize API: WP_Customize_Sidebar_Section class
4 *
5 * @package WordPress
6 * @subpackage Customize
7 * @since 4.4.0
8 */
9
10/**
11 * Customizer section representing widget area (sidebar).
12 *
13 * @since 4.1.0
14 *
15 * @see WP_Customize_Section
16 */
17class WP_Customize_Sidebar_Section extends WP_Customize_Section {
18
19 /**
20 * Type of this section.
21 *
22 * @since 4.1.0
23 * @var string
24 */
25 public $type = 'sidebar';
26
27 /**
28 * Unique identifier.
29 *
30 * @since 4.1.0
31 * @var string
32 */
33 public $sidebar_id;
34
35 /**
36 * Gather the parameters passed to client JavaScript via JSON.
37 *
38 * @since 4.1.0
39 *
40 * @return array The array to be exported to the client as JSON.
41 */
42 public function json() {
43 $json = parent::json();
44 $json['sidebarId'] = $this->sidebar_id;
45 return $json;
46 }
47
48 /**
49 * Whether the current sidebar is rendered on the page.
50 *
51 * @since 4.1.0
52 *
53 * @return bool Whether sidebar is rendered.
54 */
55 public function active_callback() {
56 return $this->manager->widgets->is_sidebar_rendered( $this->sidebar_id );
57 }
58}
59