|
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 * @var string |
|
26 */ |
|
27 public $type = 'nav_menus'; |
|
28 |
|
29 /** |
|
30 * Render screen options for Menus. |
|
31 * |
|
32 * @since 4.3.0 |
|
33 */ |
|
34 public function render_screen_options() { |
|
35 // Adds the screen options. |
|
36 require_once ABSPATH . 'wp-admin/includes/nav-menu.php'; |
|
37 add_filter( 'manage_nav-menus_columns', 'wp_nav_menu_manage_columns' ); |
|
38 |
|
39 // Display screen options. |
|
40 $screen = WP_Screen::get( 'nav-menus.php' ); |
|
41 $screen->render_screen_options( array( 'wrap' => false ) ); |
|
42 } |
|
43 |
|
44 /** |
|
45 * Returns the advanced options for the nav menus page. |
|
46 * |
|
47 * Link title attribute added as it's a relatively advanced concept for new users. |
|
48 * |
|
49 * @since 4.3.0 |
|
50 * @deprecated 4.5.0 Deprecated in favor of wp_nav_menu_manage_columns(). |
|
51 */ |
|
52 public function wp_nav_menu_manage_columns() { |
|
53 _deprecated_function( __METHOD__, '4.5.0', 'wp_nav_menu_manage_columns' ); |
|
54 require_once ABSPATH . 'wp-admin/includes/nav-menu.php'; |
|
55 return wp_nav_menu_manage_columns(); |
|
56 } |
|
57 |
|
58 /** |
|
59 * An Underscore (JS) template for this panel's content (but not its container). |
|
60 * |
|
61 * Class variables for this panel class are available in the `data` JS object; |
|
62 * export custom variables by overriding WP_Customize_Panel::json(). |
|
63 * |
|
64 * @since 4.3.0 |
|
65 * |
|
66 * @see WP_Customize_Panel::print_template() |
|
67 */ |
|
68 protected function content_template() { |
|
69 ?> |
|
70 <li class="panel-meta customize-info accordion-section <# if ( ! data.description ) { #> cannot-expand<# } #>"> |
|
71 <button type="button" class="customize-panel-back" tabindex="-1"> |
|
72 <span class="screen-reader-text"><?php _e( 'Back' ); ?></span> |
|
73 </button> |
|
74 <div class="accordion-section-title"> |
|
75 <span class="preview-notice"> |
|
76 <?php |
|
77 /* translators: %s: the site/panel title in the Customizer */ |
|
78 printf( __( 'You are customizing %s' ), '<strong class="panel-title">{{ data.title }}</strong>' ); |
|
79 ?> |
|
80 </span> |
|
81 <button type="button" class="customize-help-toggle dashicons dashicons-editor-help" aria-expanded="false"> |
|
82 <span class="screen-reader-text"><?php _e( 'Help' ); ?></span> |
|
83 </button> |
|
84 <button type="button" class="customize-screen-options-toggle" aria-expanded="false"> |
|
85 <span class="screen-reader-text"><?php _e( 'Menu Options' ); ?></span> |
|
86 </button> |
|
87 </div> |
|
88 <# if ( data.description ) { #> |
|
89 <div class="description customize-panel-description">{{{ data.description }}}</div> |
|
90 <# } #> |
|
91 <div id="screen-options-wrap"> |
|
92 <?php $this->render_screen_options(); ?> |
|
93 </div> |
|
94 </li> |
|
95 <?php |
|
96 // NOTE: The following is a workaround for an inability to treat (and thus label) a list of sections as a whole. |
|
97 ?> |
|
98 <li class="customize-control-title customize-section-title-nav_menus-heading"><?php _e( 'Menus' ); ?></li> |
|
99 <?php |
|
100 } |
|
101 } |