Skip to content

Commit

Permalink
Rename variable to postTypeEntities
Browse files Browse the repository at this point in the history
  • Loading branch information
SantosGuillamot committed Oct 16, 2024
1 parent 9588539 commit 8af840e
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions packages/editor/src/components/provider/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export const ExperimentalEditorProvider = withRegistryProvider(
BlockEditorProviderComponent = ExperimentalBlockEditorProvider,
__unstableTemplate: template,
} ) => {
const { editorSettings, selection, isReady, mode, postTypes } =
const { editorSettings, selection, isReady, mode, postTypeEntities } =
useSelect(
( select ) => {
const {
Expand All @@ -180,7 +180,7 @@ export const ExperimentalEditorProvider = withRegistryProvider(
isReady: __unstableIsEditorReady(),
mode: getRenderingMode(),
selection: getEditorSelection(),
postTypes:
postTypeEntities:
post.type === 'wp_template'
? getEntitiesConfig( 'postType' )
: null,
Expand All @@ -200,10 +200,11 @@ export const ExperimentalEditorProvider = withRegistryProvider(
postContext.postType = 'post';
} else if ( post.slug.split( '-' )[ 0 ] === 'single' ) {
// If the slug is single-{postType}, infer the post type from the name.
const postTypesNames =
postTypes?.map( ( entity ) => entity.name ) || [];
const postTypeNames =
postTypeEntities?.map( ( entity ) => entity.name ) ||
[];
const match = post.slug.match(
`^single-(${ postTypesNames.join( '|' ) })(?:-.+)?$`
`^single-(${ postTypeNames.join( '|' ) })(?:-.+)?$`
);
if ( match ) {
postContext.postType = match[ 1 ];
Expand All @@ -230,7 +231,7 @@ export const ExperimentalEditorProvider = withRegistryProvider(
post.type,
rootLevelPost.type,
rootLevelPost.slug,
postTypes,
postTypeEntities,
] );
const { id, type } = rootLevelPost;
const blockEditorSettings = useBlockEditorSettings(
Expand Down

0 comments on commit 8af840e

Please sign in to comment.