mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-11 08:04:32 +00:00
Customizer: Implement indicators for invalid nav menu items.
The same indicator on the nav menus admin page is now present for nav menu items in the Customizer. When a menu item is present for a post type that is no longer registered, the menu item will appear with the indicator. Props kucrut, westonruter. Fixes #33665. git-svn-id: https://develop.svn.wordpress.org/trunk@35302 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1250,16 +1250,21 @@
|
||||
return;
|
||||
}
|
||||
|
||||
var titleEl = control.container.find( '.menu-item-title' );
|
||||
var titleEl = control.container.find( '.menu-item-title' ),
|
||||
titleText = item.title || api.Menus.data.l10n.untitled;
|
||||
|
||||
if ( item._invalid ) {
|
||||
titleText = api.Menus.data.l10n.invalidTitleTpl.replace( '%s', titleText );
|
||||
}
|
||||
|
||||
// Don't update to an empty title.
|
||||
if ( item.title ) {
|
||||
titleEl
|
||||
.text( item.title )
|
||||
.text( titleText )
|
||||
.removeClass( 'no-title' );
|
||||
} else {
|
||||
titleEl
|
||||
.text( api.Menus.data.l10n.untitled )
|
||||
.text( titleText )
|
||||
.addClass( 'no-title' );
|
||||
}
|
||||
} );
|
||||
@@ -1303,9 +1308,9 @@
|
||||
'menu-item-edit-inactive'
|
||||
];
|
||||
|
||||
if ( settingValue.invalid ) {
|
||||
containerClasses.push( 'invalid' );
|
||||
control.params.title = api.Menus.data.invalidTitleTpl.replace( '%s', control.params.title );
|
||||
if ( settingValue._invalid ) {
|
||||
containerClasses.push( 'menu-item-invalid' );
|
||||
control.params.title = api.Menus.data.l10n.invalidTitleTpl.replace( '%s', control.params.title );
|
||||
} else if ( 'draft' === settingValue.status ) {
|
||||
containerClasses.push( 'pending' );
|
||||
control.params.title = api.Menus.data.pendingTitleTpl.replace( '%s', control.params.title );
|
||||
|
||||
Reference in New Issue
Block a user