From ca5c32cfabee67d3fd3fb553f12fb79fe4099665 Mon Sep 17 00:00:00 2001 From: Dino Turopoli Date: Wed, 13 Nov 2024 11:51:02 +0100 Subject: [PATCH] feat: csfeature title --- .../ClassificationstoreFeatureType/Helper.php | 13 +++++++++++++ src/GraphQL/TypeInterface/CsFeature.php | 3 +++ 2 files changed, 16 insertions(+) diff --git a/src/GraphQL/ClassificationstoreFeatureType/Helper.php b/src/GraphQL/ClassificationstoreFeatureType/Helper.php index 42549f99..1fc39f0f 100644 --- a/src/GraphQL/ClassificationstoreFeatureType/Helper.php +++ b/src/GraphQL/ClassificationstoreFeatureType/Helper.php @@ -48,6 +48,19 @@ public static function getCommonFields() } }, ], + 'title' => [ + 'type' => Type::string(), + 'resolve' => static function ($value = null, $args = [], $context = [], ResolveInfo $resolveInfo = null) { + if ($value instanceof FeatureDescriptor) { + $keyConfig = KeyConfig::getById($value->getId()); + if ($keyConfig) { + return $keyConfig->getTitle(); + } + } + + return null; + }, + ], 'description' => [ 'type' => Type::string(), 'resolve' => static function ($value = null, $args = [], $context = [], ResolveInfo $resolveInfo = null) { diff --git a/src/GraphQL/TypeInterface/CsFeature.php b/src/GraphQL/TypeInterface/CsFeature.php index de9887bb..12f1ffbf 100644 --- a/src/GraphQL/TypeInterface/CsFeature.php +++ b/src/GraphQL/TypeInterface/CsFeature.php @@ -41,6 +41,9 @@ public static function getInstance() 'name' => [ 'type' => Type::string(), ], + 'title' => [ + 'type' => Type::string(), + ], 'type' => [ 'type' => Type::string(), ],