added link to gql
This commit is contained in:
@@ -37,6 +37,7 @@ type Textref implements NodeInterface & TextInterface{
|
|||||||
field_titre_regular: String
|
field_titre_regular: String
|
||||||
field_titre_italique: String
|
field_titre_italique: String
|
||||||
edition: [Taxoterm]
|
edition: [Taxoterm]
|
||||||
|
lien_reference: Link
|
||||||
text_produits: [Textprod]
|
text_produits: [Textprod]
|
||||||
text_en_rebond: [Textref]
|
text_en_rebond: [Textref]
|
||||||
tags: [Taxoterm]
|
tags: [Taxoterm]
|
||||||
|
|||||||
+29
-2
@@ -77,7 +77,7 @@ class EnFrSchemaExtension extends SdlSchemaExtensionPluginBase {
|
|||||||
//
|
//
|
||||||
// $this->addAddress($registry, $builder);
|
// $this->addAddress($registry, $builder);
|
||||||
//
|
//
|
||||||
// $this->addLink($registry, $builder);
|
$this->addLink($registry, $builder);
|
||||||
//
|
//
|
||||||
// $this->addShowroom($registry, $builder);
|
// $this->addShowroom($registry, $builder);
|
||||||
//
|
//
|
||||||
@@ -317,6 +317,13 @@ class EnFrSchemaExtension extends SdlSchemaExtensionPluginBase {
|
|||||||
->map('field', $builder->fromValue('field_edition'))
|
->map('field', $builder->fromValue('field_edition'))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$registry->addFieldResolver('Textref', 'lien_reference',
|
||||||
|
$builder->produce('property_path')
|
||||||
|
->map('type', $builder->fromValue('entity:node'))
|
||||||
|
->map('value', $builder->fromParent())
|
||||||
|
->map('path', $builder->fromValue('field_lien_reference'))
|
||||||
|
);
|
||||||
|
|
||||||
$registry->addFieldResolver('Textref', 'fichiers',
|
$registry->addFieldResolver('Textref', 'fichiers',
|
||||||
$builder->produce('entity_reference')
|
$builder->produce('entity_reference')
|
||||||
->map('entity', $builder->fromParent())
|
->map('entity', $builder->fromParent())
|
||||||
@@ -542,6 +549,8 @@ class EnFrSchemaExtension extends SdlSchemaExtensionPluginBase {
|
|||||||
->map('id', $builder->fromArgument('id'))
|
->map('id', $builder->fromArgument('id'))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$registry->addFieldResolver('Creation', 'id',
|
$registry->addFieldResolver('Creation', 'id',
|
||||||
$builder->produce('entity_id')
|
$builder->produce('entity_id')
|
||||||
->map('entity', $builder->fromParent())
|
->map('entity', $builder->fromParent())
|
||||||
@@ -573,7 +582,7 @@ class EnFrSchemaExtension extends SdlSchemaExtensionPluginBase {
|
|||||||
->map('entity', $builder->fromParent())
|
->map('entity', $builder->fromParent())
|
||||||
));
|
));
|
||||||
|
|
||||||
$registry->addFieldResolver('Creation', 'description',
|
$registry->addFieldResolver('Creation', 'texte',
|
||||||
$builder->produce('property_path')
|
$builder->produce('property_path')
|
||||||
->map('type', $builder->fromValue('entity:node'))
|
->map('type', $builder->fromValue('entity:node'))
|
||||||
->map('value', $builder->fromParent())
|
->map('value', $builder->fromParent())
|
||||||
@@ -857,6 +866,8 @@ class EnFrSchemaExtension extends SdlSchemaExtensionPluginBase {
|
|||||||
->map('id', $builder->fromArgument('id'))
|
->map('id', $builder->fromArgument('id'))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$registry->addFieldResolver('Taxoterm', 'id',
|
$registry->addFieldResolver('Taxoterm', 'id',
|
||||||
$builder->produce('entity_id')
|
$builder->produce('entity_id')
|
||||||
->map('entity', $builder->fromParent())
|
->map('entity', $builder->fromParent())
|
||||||
@@ -933,4 +944,20 @@ class EnFrSchemaExtension extends SdlSchemaExtensionPluginBase {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// _ _ _
|
||||||
|
// | | (_)_ _ | |__
|
||||||
|
// | |__| | ' \| / /
|
||||||
|
// |____|_|_||_|_\_\
|
||||||
|
protected function addLink(ResolverRegistryInterface $registry, ResolverBuilder $builder) {
|
||||||
|
$registry->addFieldResolver('Link', 'url',
|
||||||
|
$builder->callback(function ($parent, $args) {
|
||||||
|
return isset($parent[0]) ? $parent[0]['uri'] : null;
|
||||||
|
})
|
||||||
|
);
|
||||||
|
$registry->addFieldResolver('Link', 'title',
|
||||||
|
$builder->callback(function ($parent, $args) {
|
||||||
|
return isset($parent[0]) ? $parent[0]['title'] : null;
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user