|
@@ -902,6 +902,22 @@ class MaterioSchemaExtension extends SdlSchemaExtensionPluginBase {
|
|
})
|
|
})
|
|
));
|
|
));
|
|
|
|
|
|
|
|
+ $registry->addFieldResolver('Image', 'style_showroomhome',
|
|
|
|
+ $builder->produce('image_derivative')
|
|
|
|
+ ->map('entity', $builder->fromParent())
|
|
|
|
+ ->map('style', $builder->fromValue('home_showroom'))
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ $registry->addFieldResolver('Image', 'style_showroomhome_url',
|
|
|
|
+ $builder->compose(
|
|
|
|
+ $builder->produce('image_derivative')
|
|
|
|
+ ->map('entity', $builder->fromParent())
|
|
|
|
+ ->map('style', $builder->fromValue('home_showroom')),
|
|
|
|
+ $builder->callback(function($parent, $args){
|
|
|
|
+ return $parent['url'];
|
|
|
|
+ })
|
|
|
|
+ ));
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
// __ ___ _ _ _ _
|
|
// __ ___ _ _ _ _
|
|
@@ -979,11 +995,31 @@ class MaterioSchemaExtension extends SdlSchemaExtensionPluginBase {
|
|
// \__ \ ' \/ _ \ V V / '_/ _ \/ _ \ ' \
|
|
// \__ \ ' \/ _ \ V V / '_/ _ \/ _ \ ' \
|
|
// |___/_||_\___/\_/\_/|_| \___/\___/_|_|_|
|
|
// |___/_||_\___/\_/\_/|_| \___/\___/_|_|_|
|
|
protected function addShowroom(ResolverRegistryInterface $registry, ResolverBuilder $builder) {
|
|
protected function addShowroom(ResolverRegistryInterface $registry, ResolverBuilder $builder) {
|
|
|
|
+
|
|
|
|
+ $registry->addFieldResolver('Query', 'allshowrooms',
|
|
|
|
+ $builder->compose(
|
|
|
|
+ $builder->callback(function($parent, $arg){
|
|
|
|
+ $entity_storage = \Drupal::entityTypeManager()->getStorage('taxonomy_term');
|
|
|
|
+ $query = $entity_storage->getQuery()
|
|
|
|
+ ->condition('vid', ['showroom'], 'IN')
|
|
|
|
+ ->sort('tid')
|
|
|
|
+ ->accessCheck(TRUE);
|
|
|
|
+ $results = $query->execute();
|
|
|
|
+ return $results;
|
|
|
|
+ }),
|
|
|
|
+ $builder->produce('entity_load_multiple')
|
|
|
|
+ ->map('type', $builder->fromValue('taxonomy_term'))
|
|
|
|
+ ->map('ids', $builder->fromParent())
|
|
|
|
+ ->map('language', $builder->fromArgument('lang'))
|
|
|
|
+ )
|
|
|
|
+ );
|
|
|
|
+
|
|
$registry->addFieldResolver('Query', 'showroom',
|
|
$registry->addFieldResolver('Query', 'showroom',
|
|
$builder->produce('entity_load')
|
|
$builder->produce('entity_load')
|
|
->map('type', $builder->fromValue('taxonomy_term'))
|
|
->map('type', $builder->fromValue('taxonomy_term'))
|
|
->map('bundles', $builder->fromValue(['showroom']))
|
|
->map('bundles', $builder->fromValue(['showroom']))
|
|
->map('id', $builder->fromArgument('id'))
|
|
->map('id', $builder->fromArgument('id'))
|
|
|
|
+ ->map('language', $builder->fromArgument('lang'))
|
|
);
|
|
);
|
|
|
|
|
|
$registry->addFieldResolver('Showroom', 'id',
|
|
$registry->addFieldResolver('Showroom', 'id',
|
|
@@ -1001,6 +1037,12 @@ class MaterioSchemaExtension extends SdlSchemaExtensionPluginBase {
|
|
->map('entity', $builder->fromParent())
|
|
->map('entity', $builder->fromParent())
|
|
);
|
|
);
|
|
|
|
|
|
|
|
+ $registry->addFieldResolver('Showroom', 'description',
|
|
|
|
+ $builder->callback(function($parent, $args){
|
|
|
|
+ return $parent->getDescription();
|
|
|
|
+ })
|
|
|
|
+ );
|
|
|
|
+
|
|
$registry->addFieldResolver('Showroom', 'email',
|
|
$registry->addFieldResolver('Showroom', 'email',
|
|
$builder->produce('property_path')
|
|
$builder->produce('property_path')
|
|
->map('type', $builder->fromValue('entity:taxonomy_term'))
|
|
->map('type', $builder->fromValue('entity:taxonomy_term'))
|
|
@@ -1022,6 +1064,26 @@ class MaterioSchemaExtension extends SdlSchemaExtensionPluginBase {
|
|
->map('path', $builder->fromValue('field_public_phone.value'))
|
|
->map('path', $builder->fromValue('field_public_phone.value'))
|
|
);
|
|
);
|
|
|
|
|
|
|
|
+ $registry->addFieldResolver('Showroom', 'images',
|
|
|
|
+ $builder->produce('entity_reference')
|
|
|
|
+ ->map('entity', $builder->fromParent())
|
|
|
|
+ ->map('field', $builder->fromValue('field_visuels'))
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ $registry->addFieldResolver('Showroom', 'website',
|
|
|
|
+ $builder->produce('property_path')
|
|
|
|
+ ->map('type', $builder->fromValue('entity:taxonomy_term'))
|
|
|
|
+ ->map('value', $builder->fromParent())
|
|
|
|
+ ->map('path', $builder->fromValue('field_website'))
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ $registry->addFieldResolver('Showroom', 'country',
|
|
|
|
+ $builder->produce('property_path')
|
|
|
|
+ ->map('type', $builder->fromValue('entity:taxonomy_term'))
|
|
|
|
+ ->map('value', $builder->fromParent())
|
|
|
|
+ ->map('path', $builder->fromValue('field_public_address'))
|
|
|
|
+ );
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
// _ _ _
|
|
// _ _ _
|