@@ -80,7 +80,7 @@ const adminService = (context: { strapi: Core.Strapi }) => ({
8080 preferCustomContentTypes,
8181 } = config ;
8282
83- const isGQLPluginEnabled = ! ! strapi . plugin ( 'graphql' ) ;
83+ const isGQLPluginEnabled = ! ! context . strapi . plugin ( 'graphql' ) ;
8484
8585 let extendedResult : Record < string , unknown > = {
8686 allowedContentTypes : ALLOWED_CONTENT_TYPES ,
@@ -103,9 +103,7 @@ const adminService = (context: { strapi: Core.Strapi }) => ({
103103 ? additionalFields
104104 : additionalFields . filter ( ( field ) => typeof field === 'string' || ! ! field . enabled ) ,
105105 gql : {
106- navigationItemRelated : configContentTypes . map ( ( { labelSingular } ) =>
107- labelSingular . replace ( / \s + / g, '' )
108- ) ,
106+ navigationItemRelated : configContentTypes . map ( ( { gqlTypeName } ) => gqlTypeName ) ,
109107 } ,
110108 isGQLPluginEnabled : viaSettingsPage ? isGQLPluginEnabled : undefined ,
111109 cascadeMenuAttached,
@@ -213,7 +211,7 @@ const adminService = (context: { strapi: Core.Strapi }) => ({
213211 }
214212
215213 const { visible = true } = pluginOptions [ 'content-manager' ] || { } ;
216- const { name = '' , description = '' } = info ;
214+ const { description = '' , displayName = '' } = info ;
217215
218216 const findRouteConfig = find (
219217 get ( context . strapi . api , `[${ modelName } ].config.routes` , [ ] ) ,
@@ -232,9 +230,10 @@ const adminService = (context: { strapi: Core.Strapi }) => ({
232230 relationNameParts . length > 1
233231 ? relationNameParts . reduce ( ( prev , curr ) => `${ prev } ${ upperFirst ( curr ) } ` , '' )
234232 : upperFirst ( modelName ) ;
235- const labelSingular =
236- name ||
237- upperFirst ( relationNameParts . length > 1 ? relationNameParts . join ( ' ' ) : relationName ) ;
233+
234+ const gqlPlugin = context . strapi . plugin ( 'graphql' ) ;
235+ const graphQlNamingPlugin = gqlPlugin ?. service ( 'utils' ) ;
236+ const gqlTypeName : string = graphQlNamingPlugin ?. naming ?. getTypeName ( item ) || '' ;
238237
239238 acc . push ( {
240239 uid,
@@ -244,14 +243,14 @@ const adminService = (context: { strapi: Core.Strapi }) => ({
244243 description,
245244 collectionName,
246245 contentTypeName,
247- label : isSingle ? labelSingular : pluralize ( name || labelSingular ) ,
246+ label : displayName ,
248247 relatedField : relatedField ? relatedField . alias : undefined ,
249- labelSingular : singularize ( labelSingular ) ,
250248 endpoint : endpoint ! ,
251249 plugin,
252250 available : isAvailable ,
253251 visible,
254252 templateName : options ?. templateName ,
253+ gqlTypeName,
255254 } ) ;
256255
257256 return acc ;
0 commit comments