diff --git a/src/web/modules/custom/enfrancais_graphql/graphql/enfr_extension.extension.graphqls b/src/web/modules/custom/enfrancais_graphql/graphql/enfr_extension.extension.graphqls index 848ebbe..8d81ef0 100644 --- a/src/web/modules/custom/enfrancais_graphql/graphql/enfr_extension.extension.graphqls +++ b/src/web/modules/custom/enfrancais_graphql/graphql/enfr_extension.extension.graphqls @@ -6,6 +6,10 @@ extend type Query { texts: [TextInterface] } +extend type Query { + text(id: Int!): TextInterface +} + extend type Query { textsdepart: [Textref] } 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 c42b339..349402c 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 @@ -142,6 +142,12 @@ class EnFrSchemaExtension extends SdlSchemaExtensionPluginBase { ->map('ids', $builder->fromParent()) ) ); + + $registry->addFieldResolver('Query', 'text', + $builder->produce('entity_load') + ->map('type', $builder->fromValue('node')) + ->map('ids', $builder->fromParent()) + ); } // _____ _ ___ _