diff --git a/src/web/modules/custom/ouatt_graphql/graphql/ouatt_extension.base.graphqls b/src/web/modules/custom/ouatt_graphql/graphql/ouatt_extension.base.graphqls index 801207e..c482971 100644 --- a/src/web/modules/custom/ouatt_graphql/graphql/ouatt_extension.base.graphqls +++ b/src/web/modules/custom/ouatt_graphql/graphql/ouatt_extension.base.graphqls @@ -59,7 +59,7 @@ type Entite implements NodeInterface { sources: [Source] concernement: Concernement image: [Image] - + confidentialite: String } type Source { diff --git a/src/web/modules/custom/ouatt_graphql/src/Plugin/GraphQL/SchemaExtension/OuattSchemaExtension.php b/src/web/modules/custom/ouatt_graphql/src/Plugin/GraphQL/SchemaExtension/OuattSchemaExtension.php index 3fcf952..896ab61 100644 --- a/src/web/modules/custom/ouatt_graphql/src/Plugin/GraphQL/SchemaExtension/OuattSchemaExtension.php +++ b/src/web/modules/custom/ouatt_graphql/src/Plugin/GraphQL/SchemaExtension/OuattSchemaExtension.php @@ -568,7 +568,23 @@ class OuattSchemaExtension extends SdlSchemaExtensionPluginBase { }) ) ); - + + // $registry->addFieldResolver('Entite', 'confidentialite', + // $builder->compose( + // $builder->callback(function(/** @var Drupal\node\Entity\node */ $parent, $arg){ + // $user = \Drupal::currentUser(); + // $can_update = $parent->access('update', $user); + // return 'hello'; + // }) + // ) + // ); + $registry->addFieldResolver('Entite', 'confidentialite', + $builder->produce('property_path') + ->map('type', $builder->fromValue('entity:node')) + ->map('value', $builder->fromParent()) + ->map('path', $builder->fromValue('field_confidentialite.value')) + ); + }