Skip to content

Commit ac3ad32

Browse files
author
Bertrand Dunogier
committed
Added _name field to content items
Gives the content name. Respects siteaccess prioritized languages list.
1 parent 207103e commit ac3ad32

3 files changed

Lines changed: 13 additions & 0 deletions

File tree

GraphQL/Resolver/DomainContentResolver.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,11 @@ private function makeDomainContentTypeName(ContentType $contentType)
180180
return $converter->denormalize($contentType->identifier) . 'Content';
181181
}
182182

183+
public function resolveContentName(ContentInfo $contentInfo)
184+
{
185+
return $this->repository->getContentService()->loadContentByContentInfo($contentInfo)->getName();
186+
}
187+
183188
/**
184189
* @return \eZ\Publish\API\Repository\ContentService
185190
*/

Resources/config/graphql/DomainContent.types.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ DomainContent:
2121
_allLocations:
2222
description: "All the content's locations"
2323
type: "[Location]"
24+
_name:
25+
description: "The content item's name, in the prioritized language(s), based on the object name pattern"
26+
type: String
2427
resolveType: "@=resolver('DomainContentType', [value])"
2528

2629
AbstractDomainContent:
@@ -52,6 +55,10 @@ AbstractDomainContent:
5255
description: 'All the locations'
5356
type: '[Location]'
5457
resolve: '@=resolver("LocationsByContentId", [value.id])'
58+
_name:
59+
description: "The content item's name, in the prioritized language(s), based on the object name pattern"
60+
type: String
61+
resolve: "@=resolver('ContentName', [value])"
5562

5663
# @todo interface ?
5764
DomainContentTypeGroup:

Resources/config/resolvers.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ services:
4444
- { name: overblog_graphql.resolver, alias: "DomainContentType", method: "resolveDomainContentType" }
4545
- { name: overblog_graphql.resolver, alias: "DomainContentItem", method: "resolveDomainContentItem" }
4646
- { name: overblog_graphql.resolver, alias: "DomainRelationFieldValue", method: "resolveDomainRelationFieldValue" }
47+
- { name: overblog_graphql.resolver, alias: "ContentName", method: "resolveContentName" }
4748
arguments:
4849
$repository: "@ezpublish.siteaccessaware.repository"
4950

0 commit comments

Comments
 (0)