[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/customize/ -> class-wp-customize-nav-menu-control.php (source)

   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   * @see WP_Customize_Control
  16   */
  17  class WP_Customize_Nav_Menu_Control extends WP_Customize_Control {
  18  
  19      /**
  20       * Control type.
  21       *
  22       * @since 4.3.0
  23       * @var string
  24       */
  25      public $type = 'nav_menu';
  26  
  27      /**
  28       * Don't render the control's content - it uses a JS template instead.
  29       *
  30       * @since 4.3.0
  31       */
  32  	public function render_content() {}
  33  
  34      /**
  35       * JS/Underscore template for the control UI.
  36       *
  37       * @since 4.3.0
  38       */
  39  	public function content_template() {
  40          $add_items = __( 'Add Items' );
  41          ?>
  42          <p class="new-menu-item-invitation">
  43              <?php
  44              printf(
  45                  /* translators: %s: "Add Items" button text. */
  46                  __( 'Time to add some links! Click &#8220;%s&#8221; to start putting pages, categories, and custom links in your menu. Add as many things as you would like.' ),
  47                  $add_items
  48              );
  49              ?>
  50          </p>
  51          <div class="customize-control-nav_menu-buttons">
  52              <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">
  53                  <?php echo $add_items; ?>
  54              </button>
  55              <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 }}">
  56                  <span class="reorder"><?php _e( 'Reorder' ); ?></span>
  57                  <span class="reorder-done"><?php _e( 'Done' ); ?></span>
  58              </button>
  59          </div>
  60          <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>
  61          <?php
  62      }
  63  
  64      /**
  65       * Return parameters for this control.
  66       *
  67       * @since 4.3.0
  68       *
  69       * @return array Exported parameters.
  70       */
  71  	public function json() {
  72          $exported            = parent::json();
  73          $exported['menu_id'] = $this->setting->term_id;
  74  
  75          return $exported;
  76      }
  77  }


Generated: Sun Dec 22 01:00:02 2024 Cross-referenced by PHPXref 0.7.1