|
@@ -168,7 +168,7 @@ class EnFrSchemaExtension extends SdlSchemaExtensionPluginBase {
|
|
|
throw new Error('Could not resolve content type.');
|
|
|
});
|
|
|
|
|
|
- $registry->addFieldResolver('Query', 'mapitems',
|
|
|
+ $registry->addFieldResolver('Query', 'allmapitems',
|
|
|
$builder->compose(
|
|
|
$builder->callback(function($parent, $arg){
|
|
|
$entity_storage = \Drupal::entityTypeManager()->getStorage('node');
|
|
@@ -184,11 +184,44 @@ class EnFrSchemaExtension extends SdlSchemaExtensionPluginBase {
|
|
|
)
|
|
|
);
|
|
|
|
|
|
+ $registry->addFieldResolver('Query', 'mapitems',
|
|
|
+ $builder->compose(
|
|
|
+ $builder->callback(function($parent, $arg){
|
|
|
+ $entity_storage = \Drupal::entityTypeManager()->getStorage('node');
|
|
|
+ $query = $entity_storage->getQuery()
|
|
|
+ ->condition('type', ['texte', 'texte_prod', 'creation'], 'IN')
|
|
|
+ ->accessCheck(TRUE);
|
|
|
+ $results = $query->execute();
|
|
|
+ return $results;
|
|
|
+ }),
|
|
|
+ $builder->produce('entity_load_multiple')
|
|
|
+ ->map('type', $builder->fromValue('node'))
|
|
|
+ ->map('ids', $builder->fromArgument('ids'))
|
|
|
+ )
|
|
|
+ );
|
|
|
+
|
|
|
$registry->addFieldResolver('Query', 'mapitem',
|
|
|
$builder->produce('entity_load')
|
|
|
->map('type', $builder->fromValue('node'))
|
|
|
->map('id', $builder->fromArgument('id'))
|
|
|
);
|
|
|
+
|
|
|
+ $registry->addFieldResolver('Query', 'allmapitemsof',
|
|
|
+ $builder->compose(
|
|
|
+ $builder->callback(function($parent, $arg){
|
|
|
+ $entity_storage = \Drupal::entityTypeManager()->getStorage('node');
|
|
|
+ $query = $entity_storage->getQuery()
|
|
|
+ ->condition('type', ['texte', 'texte_prod'], 'IN')
|
|
|
+ ->condition('field_famille', $arg)
|
|
|
+ ->accessCheck(TRUE);
|
|
|
+ $results = $query->execute();
|
|
|
+ return $results;
|
|
|
+ }),
|
|
|
+ $builder->produce('entity_load_multiple')
|
|
|
+ ->map('type', $builder->fromValue('node'))
|
|
|
+ ->map('ids', $builder->fromParent())
|
|
|
+ )
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
// _____ _ ___ _
|