class-wp-customize-nav-menu-auto-add-control.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /**
  3. * Customize API: WP_Customize_Nav_Menu_Auto_Add_Control class
  4. *
  5. * @package WordPress
  6. * @subpackage Customize
  7. * @since 4.4.0
  8. */
  9. /**
  10. * Customize control to represent the auto_add field for a given menu.
  11. *
  12. * @since 4.3.0
  13. *
  14. * @see WP_Customize_Control
  15. */
  16. class WP_Customize_Nav_Menu_Auto_Add_Control extends WP_Customize_Control {
  17. /**
  18. * Type of control, used by JS.
  19. *
  20. * @since 4.3.0
  21. * @var string
  22. */
  23. public $type = 'nav_menu_auto_add';
  24. /**
  25. * No-op since we're using JS template.
  26. *
  27. * @since 4.3.0
  28. */
  29. protected function render_content() {}
  30. /**
  31. * Render the Underscore template for this control.
  32. *
  33. * @since 4.3.0
  34. */
  35. protected function content_template() {
  36. ?>
  37. <# var elementId = _.uniqueId( 'customize-nav-menu-auto-add-control-' ); #>
  38. <span class="customize-control-title"><?php _e( 'Menu Options' ); ?></span>
  39. <span class="customize-inside-control-row">
  40. <input id="{{ elementId }}" type="checkbox" class="auto_add" />
  41. <label for="{{ elementId }}">
  42. <?php _e( 'Automatically add new top-level pages to this menu' ); ?>
  43. </label>
  44. </span>
  45. <?php
  46. }
  47. }