Make WordPress Core

Changeset 36573


Ignore:
Timestamp:
02/18/2016 05:15:28 PM (8 years ago)
Author:
ocean90
Message:

Customizer: In nav menus show the location name instead of slug.

Props ryankienstra.
Fixes #34755.

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/js/customize-nav-menus.js

    r36432 r36573  
    2525            nav_menu: {},
    2626            nav_menu_item: {}
    27         }
     27        },
     28        locationSlugMappedToName: {}
    2829    };
    2930    if ( 'undefined' !== typeof _wpCustomizeNavMenusSettings ) {
     
    806807         * @param {array} themeLocations
    807808         */
    808         updateAssignedLocationsInSectionTitle: function( themeLocations ) {
     809        updateAssignedLocationsInSectionTitle: function( themeLocationSlugs ) {
    809810            var section = this,
    810811                $title;
     
    812813            $title = section.container.find( '.accordion-section-title:first' );
    813814            $title.find( '.menu-in-location' ).remove();
    814             _.each( themeLocations, function( themeLocation ) {
    815                 var $label = $( '<span class="menu-in-location"></span>' );
    816                 $label.text( api.Menus.data.l10n.menuLocation.replace( '%s', themeLocation ) );
     815            _.each( themeLocationSlugs, function( themeLocationSlug ) {
     816                var $label, locationName;
     817                $label = $( '<span class="menu-in-location"></span>' );
     818                locationName = api.Menus.data.locationSlugMappedToName[ themeLocationSlug ];
     819                $label.text( api.Menus.data.l10n.menuLocation.replace( '%s', locationName ) );
    817820                $title.append( $label );
    818821            });
    819822
    820             section.container.toggleClass( 'assigned-to-menu-location', 0 !== themeLocations.length );
     823            section.container.toggleClass( 'assigned-to-menu-location', 0 !== themeLocationSlugs.length );
    821824
    822825        },
  • trunk/src/wp-includes/class-wp-customize-nav-menus.php

    r36422 r36573  
    351351                'unnamed'           => _x( '(unnamed)', 'Missing menu name.' ),
    352352                'custom_label'      => __( 'Custom Link' ),
    353                 /* translators: %s: menu location slug */
     353                /* translators: %s: menu location */
    354354                'menuLocation'      => _x( '(Currently set to: %s)', 'menu' ),
    355355                'menuNameLabel'     => __( 'Menu Name' ),
     
    382382                'nav_menu_item' => $temp_nav_menu_item_setting->default,
    383383            ),
     384            'locationSlugMappedToName' => get_registered_nav_menus(),
    384385        );
    385386
Note: See TracChangeset for help on using the changeset viewer.