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