home *** CD-ROM | disk | FTP | other *** search
/ HTML Examples / WP.iso / wordpress2 / wp-includes / customize / class-wp-customize-nav-menu-control.php < prev    next >
Encoding:
PHP Script  |  2018-01-23  |  2.0 KB  |  76 lines

  1. <?php
  2. /**
  3.  * Customize API: WP_Customize_Nav_Menu_Control class
  4.  *
  5.  * @package WordPress
  6.  * @subpackage Customize
  7.  * @since 4.4.0
  8.  */
  9.  
  10. /**
  11.  * Customize Nav Menu Control Class.
  12.  *
  13.  * @since 4.3.0
  14.  */
  15. class WP_Customize_Nav_Menu_Control extends WP_Customize_Control {
  16.  
  17.     /**
  18.      * Control type.
  19.      *
  20.      * @since 4.3.0
  21.      * @var string
  22.      */
  23.     public $type = 'nav_menu';
  24.  
  25.     /**
  26.      * Don't render the control's content - it uses a JS template instead.
  27.      *
  28.      * @since 4.3.0
  29.      */
  30.     public function render_content() {}
  31.  
  32.     /**
  33.      * JS/Underscore template for the control UI.
  34.      *
  35.      * @since 4.3.0
  36.      */
  37.     public function content_template() {
  38.         $add_items = __( 'Add Items' );
  39.         ?>
  40.         <p class="new-menu-item-invitation">
  41.             <?php
  42.             printf(
  43.                 /* translators: %s: "Add Items" button text */
  44.                 __( 'Time to add some links! Click “%s” to start putting pages, categories, and custom links in your menu. Add as many things as you’d like.' ),
  45.                 $add_items
  46.             );
  47.             ?>
  48.         </p>
  49.         <div class="customize-control-nav_menu-buttons">
  50.             <button type="button" class="button add-new-menu-item" aria-label="<?php esc_attr_e( 'Add or remove menu items' ); ?>" aria-expanded="false" aria-controls="available-menu-items">
  51.                 <?php echo $add_items; ?>
  52.             </button>
  53.             <button type="button" class="button-link reorder-toggle" aria-label="<?php esc_attr_e( 'Reorder menu items' ); ?>" aria-describedby="reorder-items-desc-{{ data.menu_id }}">
  54.                 <span class="reorder"><?php _e( 'Reorder' ); ?></span>
  55.                 <span class="reorder-done"><?php _e( 'Done' ); ?></span>
  56.             </button>
  57.         </div>
  58.         <p class="screen-reader-text" id="reorder-items-desc-{{ data.menu_id }}"><?php _e( 'When in reorder mode, additional controls to reorder menu items will be available in the items list above.' ); ?></p>
  59.         <?php
  60.     }
  61.  
  62.     /**
  63.      * Return parameters for this control.
  64.      *
  65.      * @since 4.3.0
  66.      *
  67.      * @return array Exported parameters.
  68.      */
  69.     public function json() {
  70.         $exported            = parent::json();
  71.         $exported['menu_id'] = $this->setting->term_id;
  72.  
  73.         return $exported;
  74.     }
  75. }
  76.