]> scripts.mit.edu Git - autoinstalls/wordpress.git/blob - wp-includes/customize/class-wp-customize-nav-menus-panel.php
WordPress 4.4-scripts
[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                 // Essentially adds the screen options.
38                 add_filter( 'manage_nav-menus_columns', array( $this, 'wp_nav_menu_manage_columns' ) );
39
40                 // Display screen options.
41                 $screen = WP_Screen::get( 'nav-menus.php' );
42                 $screen->render_screen_options( array( 'wrap' => false ) );
43         }
44
45         /**
46          * Returns the advanced options for the nav menus page.
47          *
48          * Link title attribute added as it's a relatively advanced concept for new users.
49          *
50          * @since 4.3.0
51          * @access public
52          *
53          * @return array The advanced menu properties.
54          */
55         public function wp_nav_menu_manage_columns() {
56                 return array(
57                         '_title'      => __( 'Show advanced menu properties' ),
58                         'cb'          => '<input type="checkbox" />',
59                         'link-target' => __( 'Link Target' ),
60                         'attr-title'  => __( 'Title Attribute' ),
61                         'css-classes' => __( 'CSS Classes' ),
62                         'xfn'         => __( 'Link Relationship (XFN)' ),
63                         'description' => __( 'Description' ),
64                 );
65         }
66
67         /**
68          * An Underscore (JS) template for this panel's content (but not its container).
69          *
70          * Class variables for this panel class are available in the `data` JS object;
71          * export custom variables by overriding WP_Customize_Panel::json().
72          *
73          * @since 4.3.0
74          * @access protected
75          *
76          * @see WP_Customize_Panel::print_template()
77          */
78         protected function content_template() {
79                 ?>
80                 <li class="panel-meta customize-info accordion-section <# if ( ! data.description ) { #> cannot-expand<# } #>">
81                         <button type="button" class="customize-panel-back" tabindex="-1">
82                                 <span class="screen-reader-text"><?php _e( 'Back' ); ?></span>
83                         </button>
84                         <div class="accordion-section-title">
85                                 <span class="preview-notice">
86                                         <?php
87                                         /* Translators: %s is the site/panel title in the Customizer. */
88                                         printf( __( 'You are customizing %s' ), '<strong class="panel-title">{{ data.title }}</strong>' );
89                                         ?>
90                                 </span>
91                                 <button type="button" class="customize-help-toggle dashicons dashicons-editor-help" aria-expanded="false">
92                                         <span class="screen-reader-text"><?php _e( 'Help' ); ?></span>
93                                 </button>
94                                 <button type="button" class="customize-screen-options-toggle" aria-expanded="false">
95                                         <span class="screen-reader-text"><?php _e( 'Menu Options' ); ?></span>
96                                 </button>
97                         </div>
98                         <# if ( data.description ) { #>
99                         <div class="description customize-panel-description">{{{ data.description }}}</div>
100                         <# } #>
101                         <div id="screen-options-wrap">
102                                 <?php $this->render_screen_options(); ?>
103                         </div>
104                 </li>
105         <?php
106         }
107 }