1<?php
2/**
3 * Customize API: WP_Widget_Area_Customize_Control class
4 *
5 * @package WordPress
6 * @subpackage Customize
7 * @since 4.4.0
8 */
9
10/**
11 * Widget Area Customize Control class.
12 *
13 * @since 3.9.0
14 *
15 * @see WP_Customize_Control
16 */
17class WP_Widget_Area_Customize_Control extends WP_Customize_Control {
18
19	/**
20	 * Customize control type.
21	 *
22	 * @since 3.9.0
23	 * @var string
24	 */
25	public $type = 'sidebar_widgets';
26
27	/**
28	 * Sidebar ID.
29	 *
30	 * @since 3.9.0
31	 * @var int|string
32	 */
33	public $sidebar_id;
34
35	/**
36	 * Refreshes the parameters passed to the JavaScript via JSON.
37	 *
38	 * @since 3.9.0
39	 */
40	public function to_json() {
41		parent::to_json();
42		$exported_properties = array( 'sidebar_id' );
43		foreach ( $exported_properties as $key ) {
44			$this->json[ $key ] = $this->$key;
45		}
46	}
47
48	/**
49	 * Renders the control's content.
50	 *
51	 * @since 3.9.0
52	 */
53	public function render_content() {
54		$id = 'reorder-widgets-desc-' . str_replace( array( '[', ']' ), array( '-', '' ), $this->id );
55		?>
56		<button type="button" class="button add-new-widget" aria-expanded="false" aria-controls="available-widgets">
57			<?php _e( 'Add a Widget' ); ?>
58		</button>
59		<button type="button" class="button-link reorder-toggle" aria-label="<?php esc_attr_e( 'Reorder widgets' ); ?>" aria-describedby="<?php echo esc_attr( $id ); ?>">
60			<span class="reorder"><?php _e( 'Reorder' ); ?></span>
61			<span class="reorder-done"><?php _e( 'Done' ); ?></span>
62		</button>
63		<p class="screen-reader-text" id="<?php echo esc_attr( $id ); ?>"><?php _e( 'When in reorder mode, additional controls to reorder widgets will be available in the widgets list above.' ); ?></p>
64		<?php
65	}
66}
67