wp/wp-includes/customize/class-wp-customize-nav-menu-auto-add-control.php
changeset 7 cf61fcea0001
equal deleted inserted replaced
6:490d5cc509ed 7:cf61fcea0001
       
     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 /**
       
    11  * Customize control to represent the auto_add field for a given menu.
       
    12  *
       
    13  * @since 4.3.0
       
    14  *
       
    15  * @see WP_Customize_Control
       
    16  */
       
    17 class WP_Customize_Nav_Menu_Auto_Add_Control extends WP_Customize_Control {
       
    18 
       
    19 	/**
       
    20 	 * Type of control, used by JS.
       
    21 	 *
       
    22 	 * @since 4.3.0
       
    23 	 * @var string
       
    24 	 */
       
    25 	public $type = 'nav_menu_auto_add';
       
    26 
       
    27 	/**
       
    28 	 * No-op since we're using JS template.
       
    29 	 *
       
    30 	 * @since 4.3.0
       
    31 	 */
       
    32 	protected function render_content() {}
       
    33 
       
    34 	/**
       
    35 	 * Render the Underscore template for this control.
       
    36 	 *
       
    37 	 * @since 4.3.0
       
    38 	 */
       
    39 	protected function content_template() {
       
    40 		?>
       
    41 		<# var elementId = _.uniqueId( 'customize-nav-menu-auto-add-control-' ); #>
       
    42 		<span class="customize-control-title"><?php _e( 'Menu Options' ); ?></span>
       
    43 		<span class="customize-inside-control-row">
       
    44 			<input id="{{ elementId }}" type="checkbox" class="auto_add" />
       
    45 			<label for="{{ elementId }}">
       
    46 				<?php _e( 'Automatically add new top-level pages to this menu' ); ?>
       
    47 			</label>
       
    48 		</span>
       
    49 		<?php
       
    50 	}
       
    51 }