From dcabb2e13c7947cb5f647c0a13157646d17686de Mon Sep 17 00:00:00 2001 From: ramon Date: Tue, 16 May 2023 16:33:27 +1000 Subject: [PATCH] Filling in the details :) --- .../sidebar-navigation-screen-page/index.js | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-page/index.js b/packages/edit-site/src/components/sidebar-navigation-screen-page/index.js index 6645855ab62b6..4cda481b2832c 100644 --- a/packages/edit-site/src/components/sidebar-navigation-screen-page/index.js +++ b/packages/edit-site/src/components/sidebar-navigation-screen-page/index.js @@ -10,7 +10,11 @@ import { __experimentalText as Text, ExternalLink, } from '@wordpress/components'; -import { store as coreStore, useEntityRecord } from '@wordpress/core-data'; +import { + store as coreStore, + useEntityRecord, + useEntityRecords, +} from '@wordpress/core-data'; import { decodeEntities } from '@wordpress/html-entities'; import { pencil } from '@wordpress/icons'; @@ -63,7 +67,7 @@ function getPageDetails( page ) { return [ { label: 'Template', - value: page?.template ? page?.template : 'Default', + value: page?.templateTitle, }, { label: 'Parent', @@ -90,6 +94,16 @@ export default function SidebarNavigationScreenPage() { } = useNavigator(); const { record } = useEntityRecord( 'postType', 'page', postId ); + const { records: templates, isResolving: areTemplatesLoading } = + useEntityRecords( 'postType', 'wp_template', { + per_page: -1, + } ); + + const templateTitle = areTemplatesLoading + ? '' + : templates?.find( ( template ) => template?.slug === record?.template ) + ?.title?.rendered || 'Default'; + const parentTitle = useSelect( ( select ) => { const parent = record?.parent @@ -110,6 +124,7 @@ export default function SidebarNavigationScreenPage() { }, [ record ] ); + return (