WordPress 4.5
[autoinstalls/wordpress.git] / wp-includes / customize / class-wp-customize-nav-menus-panel.php
1 <?php
2 /**
3  * Customize API: WP_Customize_Nav_Menus_Panel class
4  *
5  * @package WordPress
6  * @subpackage Customize
7  * @since 4.4.0
8  */
9
10 /**
11  * Customize Nav Menus Panel Class
12  *
13  * Needed to add screen options.
14  *
15  * @since 4.3.0
16  *
17  * @see WP_Customize_Panel
18  */
19 class WP_Customize_Nav_Menus_Panel extends WP_Customize_Panel {
20
21         /**
22          * Control type.
23          *
24          * @since 4.3.0
25          * @access public
26          * @var string
27          */
28         public $type = 'nav_menus';
29
30         /**
31          * Render screen options for Menus.
32          *
33          * @since 4.3.0
34          * @access public
35          */
36         public function render_screen_options() {
37                 // Adds the screen options.
38                 require_once ABSPATH . 'wp-admin/includes/nav-menu.php';
39                 add_filter( 'manage_nav-menus_columns', 'wp_nav_menu_manage_columns' );
40
41                 // Display screen options.
42                 $screen = WP_Screen::get( 'nav-menus.php' );
43                 $screen->render_screen_options( array( 'wrap' => false ) );
44         }
45
46         /**
47          * Returns the advanced options for the nav menus page.
48          *
49          * Link title attribute added as it's a relatively advanced concept for new users.
50          *
51          * @since 4.3.0
52          * @deprecated 4.5.0 Deprecated in favor of wp_nav_menu_manage_columns().
53          */
54         public function wp_nav_menu_manage_columns() {
55                 _deprecated_function( __METHOD__, '4.5.0', 'wp_nav_menu_manage_columns' );
56                 require_once ABSPATH . 'wp-admin/includes/nav-menu.php';
57                 return wp_nav_menu_manage_columns();
58         }
59
60         /**
61          * An Underscore (JS) template for this panel's content (but not its container).
62          *
63          * Class variables for this panel class are available in the `data` JS object;
64          * export custom variables by overriding WP_Customize_Panel::json().
65          *
66          * @since 4.3.0
67          * @access protected
68          *
69          * @see WP_Customize_Panel::print_template()
70          */
71         protected function content_template() {
72                 ?>
73                 <li class="panel-meta customize-info accordion-section <# if ( ! data.description ) { #> cannot-expand<# } #>">
74                         <button type="button" class="customize-panel-back" tabindex="-1">
75                                 <span class="screen-reader-text"><?php _e( 'Back' ); ?></span>
76                         </button>
77                         <div class="accordion-section-title">
78                                 <span class="preview-notice">
79                                         <?php
80                                         /* translators: %s: the site/panel title in the Customizer */
81                                         printf( __( 'You are customizing %s' ), '<strong class="panel-title">{{ data.title }}</strong>' );
82                                         ?>
83                                 </span>
84                                 <button type="button" class="customize-help-toggle dashicons dashicons-editor-help" aria-expanded="false">
85                                         <span class="screen-reader-text"><?php _e( 'Help' ); ?></span>
86                                 </button>
87                                 <button type="button" class="customize-screen-options-toggle" aria-expanded="false">
88                                         <span class="screen-reader-text"><?php _e( 'Menu Options' ); ?></span>
89                                 </button>
90                         </div>
91                         <# if ( data.description ) { #>
92                         <div class="description customize-panel-description">{{{ data.description }}}</div>
93                         <# } #>
94                         <div id="screen-options-wrap">
95                                 <?php $this->render_screen_options(); ?>
96                         </div>
97                 </li>
98         <?php
99         }
100 }