Skip to content

Commit

Permalink
Update labels
Browse files Browse the repository at this point in the history
  • Loading branch information
Mamaduka committed Nov 10, 2021
1 parent cbf464c commit 509fcb4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
1 change: 1 addition & 0 deletions lib/full-site-editing/template-parts.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ function gutenberg_register_template_part_post_type() {
'new_item' => __( 'New Template Part', 'gutenberg' ),
'edit_item' => __( 'Edit Template Part', 'gutenberg' ),
'view_item' => __( 'View Template Part', 'gutenberg' ),
'view_items' => __( 'View Template Parts', 'gutenberg' ),
'all_items' => __( 'All Template Parts', 'gutenberg' ),
'search_items' => __( 'Search Template Parts', 'gutenberg' ),
'parent_item_colon' => __( 'Parent Template Part:', 'gutenberg' ),
Expand Down
1 change: 1 addition & 0 deletions lib/full-site-editing/templates.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ function gutenberg_register_template_post_type() {
'new_item' => __( 'New Template', 'gutenberg' ),
'edit_item' => __( 'Edit Template', 'gutenberg' ),
'view_item' => __( 'View Template', 'gutenberg' ),
'view_items' => __( 'View Templates', 'gutenberg' ),
'all_items' => __( 'All Templates', 'gutenberg' ),
'search_items' => __( 'Search Templates', 'gutenberg' ),
'parent_item_colon' => __( 'Parent Template:', 'gutenberg' ),
Expand Down
21 changes: 16 additions & 5 deletions packages/edit-site/src/components/header/navigation-link/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* External dependencies
*/
import { get } from 'lodash';

/**
* WordPress dependencies
*/
Expand All @@ -19,10 +24,12 @@ import { addQueryArgs } from '@wordpress/url';
import { store as editSiteStore } from '../../../store';

function NavigationLink( { icon } ) {
const { isRequestingSiteIcon, postType, siteIconUrl } = useSelect(
const { isRequestingSiteIcon, templateType, siteIconUrl } = useSelect(
( select ) => {
const { getEditedPostType } = select( editSiteStore );
const { getEntityRecord, isResolving } = select( coreDataStore );
const { getEntityRecord, getPostType, isResolving } = select(
coreDataStore
);
const siteData =
getEntityRecord( 'root', '__unstableBase', undefined ) || {};

Expand All @@ -32,7 +39,7 @@ function NavigationLink( { icon } ) {
'__unstableBase',
undefined,
] ),
postType: getEditedPostType(),
templateType: getPostType( getEditedPostType() ),
siteIconUrl: siteData.site_icon_url,
};
},
Expand Down Expand Up @@ -70,10 +77,14 @@ function NavigationLink( { icon } ) {
<motion.div className="edit-site-navigation-link" whileHover="expand">
<Button
className="edit-site-navigation-link__button has-icon"
label={ __( 'Back' ) }
href={ addQueryArgs( 'edit.php', {
post_type: postType,
post_type: templateType?.slug,
} ) }
label={ get(
templateType,
[ 'labels', 'view_items' ],
__( 'Back' )
) }
>
{ buttonIcon }
</Button>
Expand Down

0 comments on commit 509fcb4

Please sign in to comment.