Customizer: Disambiguate a menu's auto-add pages option from preceding menu location checkboxes.

Creates a separate `nav_menu_auto_add` control type following the pattern of the `nav_menu_name` control type.

Props valendesigns.
Fixes #32820.


git-svn-id: https://develop.svn.wordpress.org/trunk@33189 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Weston Ruter
2015-07-13 08:39:17 +00:00
parent 77300bcc92
commit 4a849e7c24
3 changed files with 113 additions and 31 deletions
+40 -8
View File
@@ -1603,14 +1603,7 @@ class WP_Customize_Nav_Menu_Control extends WP_Customize_Control {
<?php endforeach; ?>
</ul>
<?php endif; ?>
<p>
<label>
<input type="checkbox" class="auto_add">
<?php _e( 'Automatically add new top-level pages to this menu' ) ?>
</label>
</p>
<?php
<?php endif;
}
/**
@@ -1885,6 +1878,45 @@ class WP_Customize_Nav_Menu_Name_Control extends WP_Customize_Control {
}
}
/**
* Customize control to represent the auto_add field for a given menu.
*
* @since 4.3.0
*/
class WP_Customize_Nav_Menu_Auto_Add_Control extends WP_Customize_Control {
/**
* Type of control, used by JS.
*
* @since 4.3.0
*
* @var string
*/
public $type = 'nav_menu_auto_add';
/**
* No-op since we're using JS template.
*
* @since 4.3.0
*/
protected function render_content() {}
/**
* Render the Underscore template for this control.
*
* @since 4.3.0
*/
protected function content_template() {
?>
<label>
<span class="customize-control-title"><?php _e( 'Menu Options' ); ?></span>
<input type="checkbox" class="auto_add" />
<?php _e( 'Automatically add new top-level pages to this menu' ); ?>
</label>
<?php
}
}
/**
* Customize control class for new menus.
*