-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Navigation: Add the draft status to the navigation title (#51967)
* Navigation: Add the draft status to the navigation title * Move the buildNavigationLabel function to the default export
- Loading branch information
Showing
3 changed files
with
36 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...-site/src/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { __, sprintf } from '@wordpress/i18n'; | ||
import { decodeEntities } from '@wordpress/html-entities'; | ||
|
||
// Copied from packages/block-library/src/navigation/edit/navigation-menu-selector.js. | ||
export default function buildNavigationLabel( title, id, status ) { | ||
if ( ! title?.rendered ) { | ||
/* translators: %s is the index of the menu in the list of menus. */ | ||
return sprintf( __( '(no title %s)' ), id ); | ||
} | ||
|
||
if ( status === 'publish' ) { | ||
return decodeEntities( title?.rendered ); | ||
} | ||
|
||
return sprintf( | ||
// translators: %1s: title of the menu; %2s: status of the menu (draft, pending, etc.). | ||
__( '%1$s (%2$s)' ), | ||
decodeEntities( title?.rendered ), | ||
status | ||
); | ||
} |
c5d477a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Flaky tests detected in c5d477a.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.
🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5403428852
📝 Reported issues:
/test/e2e/specs/editor/various/convert-block-type.spec.js