You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

101 line
2.8 KiB

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