diff --git a/packages/edit-site/src/components/header-edit-mode/document-actions/index.js b/packages/edit-site/src/components/header-edit-mode/document-actions/index.js index dec728b62bb61a..058dd1d054aed5 100644 --- a/packages/edit-site/src/components/header-edit-mode/document-actions/index.js +++ b/packages/edit-site/src/components/header-edit-mode/document-actions/index.js @@ -33,6 +33,13 @@ import { store as coreStore } from '@wordpress/core-data'; import useEditedEntityRecord from '../../use-edited-entity-record'; import { store as editSiteStore } from '../../../store'; +const typeLabels = { + wp_block: __( 'Editing pattern:' ), + wp_navigation: __( 'Editing navigation menu:' ), + wp_template: __( 'Editing template:' ), + wp_template_part: __( 'Editing template part:' ), +}; + export default function DocumentActions() { const isPage = useSelect( ( select ) => select( editSiteStore ).isPage(), @@ -138,7 +145,7 @@ function TemplateDocumentActions( { className, onBack } ) { onBack={ onBack } > - { getEntityLabel( record.type ) } + { typeLabels[ record.type ] ?? typeLabels.wp_template } { getTitle() } @@ -184,14 +191,3 @@ function BaseDocumentActions( { className, icon, children, onBack } ) { ); } - -function getEntityLabel( entityType ) { - const labels = { - wp_block: __( 'Editing pattern:' ), - wp_navigation: __( 'Editing navigation menu:' ), - wp_template: __( 'Editing template:' ), - wp_template_part: __( 'Editing template part:' ), - }; - - return labels[ entityType ] ?? labels.wp_template; -}