[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

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

   1  <?php
   2  /**
   3   * Customize API: WP_Customize_Nav_Menu_Locations_Control class
   4   *
   5   * @package WordPress
   6   * @subpackage Customize
   7   * @since 4.9.0
   8   */
   9  
  10  /**
  11   * Customize Nav Menu Locations Control Class.
  12   *
  13   * @since 4.9.0
  14   *
  15   * @see WP_Customize_Control
  16   */
  17  class WP_Customize_Nav_Menu_Locations_Control extends WP_Customize_Control {
  18  
  19      /**
  20       * Control type.
  21       *
  22       * @since 4.9.0
  23       * @var string
  24       */
  25      public $type = 'nav_menu_locations';
  26  
  27      /**
  28       * Don't render the control's content - it uses a JS template instead.
  29       *
  30       * @since 4.9.0
  31       */
  32  	public function render_content() {}
  33  
  34      /**
  35       * JS/Underscore template for the control UI.
  36       *
  37       * @since 4.9.0
  38       */
  39  	public function content_template() {
  40          if ( current_theme_supports( 'menus' ) ) :
  41              ?>
  42              <# var elementId; #>
  43              <ul class="menu-location-settings">
  44                  <li class="customize-control assigned-menu-locations-title">
  45                      <span class="customize-control-title">{{ wp.customize.Menus.data.l10n.locationsTitle }}</span>
  46                      <# if ( data.isCreating ) { #>
  47                          <p>
  48                              <?php echo _x( 'Where do you want this menu to appear?', 'menu locations' ); ?>
  49                              <em class="new-menu-locations-widget-note">
  50                                  <?php
  51                                  printf(
  52                                      /* translators: 1: Documentation URL, 2: Additional link attributes, 3: Accessibility text. */
  53                                      _x( '(If you plan to use a menu <a href="%1$s" %2$s>widget%3$s</a>, skip this step.)', 'menu locations' ),
  54                                      __( 'https://wordpress.org/support/article/wordpress-widgets/' ),
  55                                      ' class="external-link" target="_blank"',
  56                                      sprintf(
  57                                          '<span class="screen-reader-text"> %s</span>',
  58                                          /* translators: Accessibility text. */
  59                                          __( '(opens in a new tab)' )
  60                                      )
  61                                  );
  62                                  ?>
  63                              </em>
  64                          </p>
  65                      <# } else { #>
  66                          <p><?php echo _x( 'Here&#8217;s where this menu appears. If you&#8217;d like to change that, pick another location.', 'menu locations' ); ?></p>
  67                      <# } #>
  68                  </li>
  69  
  70                  <?php foreach ( get_registered_nav_menus() as $location => $description ) : ?>
  71                      <# elementId = _.uniqueId( 'customize-nav-menu-control-location-' ); #>
  72                      <li class="customize-control customize-control-checkbox assigned-menu-location">
  73                          <span class="customize-inside-control-row">
  74                              <input id="{{ elementId }}" type="checkbox" data-menu-id="{{ data.menu_id }}" data-location-id="<?php echo esc_attr( $location ); ?>" class="menu-location" />
  75                              <label for="{{ elementId }}">
  76                                  <?php echo $description; ?>
  77                                  <span class="theme-location-set">
  78                                      <?php
  79                                      printf(
  80                                          /* translators: %s: Menu name. */
  81                                          _x( '(Current: %s)', 'menu location' ),
  82                                          '<span class="current-menu-location-name-' . esc_attr( $location ) . '"></span>'
  83                                      );
  84                                      ?>
  85                                  </span>
  86                              </label>
  87                          </span>
  88                      </li>
  89                  <?php endforeach; ?>
  90              </ul>
  91              <?php
  92          endif;
  93      }
  94  }


Generated: Mon Oct 21 01:00:03 2019 Cross-referenced by PHPXref 0.7.1