gql besoins confidentialite field
This commit is contained in:
parent
ab16a9f516
commit
12e0d6a07b
@ -90,6 +90,7 @@ type Besoin implements NodeInterface {
|
|||||||
index: Int
|
index: Int
|
||||||
concernement: Concernement
|
concernement: Concernement
|
||||||
reponses: [Reponse]
|
reponses: [Reponse]
|
||||||
|
confidentialite: String
|
||||||
}
|
}
|
||||||
|
|
||||||
type Reponse implements NodeInterface {
|
type Reponse implements NodeInterface {
|
||||||
|
@ -797,14 +797,22 @@ class OuattSchemaExtension extends SdlSchemaExtensionPluginBase {
|
|||||||
|
|
||||||
// can-update: Boolean
|
// can-update: Boolean
|
||||||
$registry->addFieldResolver('Besoin', 'can_update',
|
$registry->addFieldResolver('Besoin', 'can_update',
|
||||||
$builder->compose(
|
$builder->compose(
|
||||||
$builder->callback(function(/** @var Drupal\node\Entity\node */ $parent, $arg){
|
$builder->callback(function(/** @var Drupal\node\Entity\node */ $parent, $arg){
|
||||||
$user = \Drupal::currentUser();
|
$user = \Drupal::currentUser();
|
||||||
$can_update = $parent->access('update', $user);
|
$can_update = $parent->access('update', $user);
|
||||||
return $can_update;
|
return $can_update;
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$registry->addFieldResolver('Besoin', 'confidentialite',
|
||||||
|
$builder->produce('property_path')
|
||||||
|
->map('type', $builder->fromValue('entity:node'))
|
||||||
|
->map('value', $builder->fromParent())
|
||||||
|
->map('path', $builder->fromValue('field_confidentialite.value'))
|
||||||
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ____
|
// ____
|
||||||
|
Loading…
x
Reference in New Issue
Block a user