Customizer: In nav menus show the location name instead of slug.
Props ryankienstra. Fixes #34755. git-svn-id: https://develop.svn.wordpress.org/trunk@36573 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
a16d97039b
commit
cc59bf5f3b
@ -24,7 +24,8 @@
|
||||
defaultSettingValues: {
|
||||
nav_menu: {},
|
||||
nav_menu_item: {}
|
||||
}
|
||||
},
|
||||
locationSlugMappedToName: {}
|
||||
};
|
||||
if ( 'undefined' !== typeof _wpCustomizeNavMenusSettings ) {
|
||||
$.extend( api.Menus.data, _wpCustomizeNavMenusSettings );
|
||||
@ -805,19 +806,21 @@
|
||||
/**
|
||||
* @param {array} themeLocations
|
||||
*/
|
||||
updateAssignedLocationsInSectionTitle: function( themeLocations ) {
|
||||
updateAssignedLocationsInSectionTitle: function( themeLocationSlugs ) {
|
||||
var section = this,
|
||||
$title;
|
||||
|
||||
$title = section.container.find( '.accordion-section-title:first' );
|
||||
$title.find( '.menu-in-location' ).remove();
|
||||
_.each( themeLocations, function( themeLocation ) {
|
||||
var $label = $( '<span class="menu-in-location"></span>' );
|
||||
$label.text( api.Menus.data.l10n.menuLocation.replace( '%s', themeLocation ) );
|
||||
_.each( themeLocationSlugs, function( themeLocationSlug ) {
|
||||
var $label, locationName;
|
||||
$label = $( '<span class="menu-in-location"></span>' );
|
||||
locationName = api.Menus.data.locationSlugMappedToName[ themeLocationSlug ];
|
||||
$label.text( api.Menus.data.l10n.menuLocation.replace( '%s', locationName ) );
|
||||
$title.append( $label );
|
||||
});
|
||||
|
||||
section.container.toggleClass( 'assigned-to-menu-location', 0 !== themeLocations.length );
|
||||
section.container.toggleClass( 'assigned-to-menu-location', 0 !== themeLocationSlugs.length );
|
||||
|
||||
},
|
||||
|
||||
|
@ -350,7 +350,7 @@ final class WP_Customize_Nav_Menus {
|
||||
'untitled' => _x( '(no label)', 'missing menu item navigation label' ),
|
||||
'unnamed' => _x( '(unnamed)', 'Missing menu name.' ),
|
||||
'custom_label' => __( 'Custom Link' ),
|
||||
/* translators: %s: menu location slug */
|
||||
/* translators: %s: menu location */
|
||||
'menuLocation' => _x( '(Currently set to: %s)', 'menu' ),
|
||||
'menuNameLabel' => __( 'Menu Name' ),
|
||||
'itemAdded' => __( 'Menu item added' ),
|
||||
@ -381,6 +381,7 @@ final class WP_Customize_Nav_Menus {
|
||||
'nav_menu' => $temp_nav_menu_setting->default,
|
||||
'nav_menu_item' => $temp_nav_menu_item_setting->default,
|
||||
),
|
||||
'locationSlugMappedToName' => get_registered_nav_menus(),
|
||||
);
|
||||
|
||||
$data = sprintf( 'var _wpCustomizeNavMenusSettings = %s;', wp_json_encode( $settings ) );
|
||||
|
Loading…
Reference in New Issue
Block a user