From a8daf129f74f1962c4fbc71cbc47e4cb27387b76 Mon Sep 17 00:00:00 2001 From: bach Date: Tue, 22 Jun 2021 16:49:54 +0200 Subject: [PATCH] added text de depart field to text ref in gql api --- .../graphql/enfr_extension.base.graphqls | 1 + .../Plugin/GraphQL/SchemaExtension/EnFrSchemaExtension.php | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/src/web/modules/custom/enfrancais_graphql/graphql/enfr_extension.base.graphqls b/src/web/modules/custom/enfrancais_graphql/graphql/enfr_extension.base.graphqls index e3b7f00..9dcf02f 100644 --- a/src/web/modules/custom/enfrancais_graphql/graphql/enfr_extension.base.graphqls +++ b/src/web/modules/custom/enfrancais_graphql/graphql/enfr_extension.base.graphqls @@ -47,6 +47,7 @@ type Textref implements NodeInterface & TextInterface & MapItemInterface{ field_titre_italique: String edition: [Taxoterm] lien_reference: Link + text_de_depart: [Textref] text_produits: [Textprod] text_en_rebond: [Textref] tags: [Taxoterm] diff --git a/src/web/modules/custom/enfrancais_graphql/src/Plugin/GraphQL/SchemaExtension/EnFrSchemaExtension.php b/src/web/modules/custom/enfrancais_graphql/src/Plugin/GraphQL/SchemaExtension/EnFrSchemaExtension.php index 38f9a29..4e6da8f 100644 --- a/src/web/modules/custom/enfrancais_graphql/src/Plugin/GraphQL/SchemaExtension/EnFrSchemaExtension.php +++ b/src/web/modules/custom/enfrancais_graphql/src/Plugin/GraphQL/SchemaExtension/EnFrSchemaExtension.php @@ -283,6 +283,13 @@ class EnFrSchemaExtension extends SdlSchemaExtensionPluginBase { ->map('entity', $builder->fromParent()) )); + $registry->addFieldResolver('Textref', 'text_de_depart', + $builder->compose( + $builder->produce('entity_reference') + ->map('entity', $builder->fromParent()) + ->map('field', $builder->fromValue('field_texte_de_depart')) + )); + $registry->addFieldResolver('Textref', 'text_en_rebond', $builder->compose( $builder->produce('entity_reference')