- Issue created by @sumit_saini
Currently FieldTypeMapItem fields in graphql are resolved to NULL. It would be good if MapItem fields can also be resolved generically.
1. Create a computed field(or a normal map field?) of map type.
2. Query field and notice that it is null. (Also its raw field do not have a value key).
This can be fixed by adding below code to CoreComposableResolver::extractFieldValue():
--- a/src/CoreComposableResolver.php
+++ b/src/CoreComposableResolver.php
@@ -349,6 +349,9 @@ class CoreComposableResolver {
if ($pluginId === 'field_item:telephone') {
return $item->value;
}
+ elseif ($pluginId === 'field_item:map') {
+ return $item->getValue();
+ }
}
return $item;
Add resolver to raw_field of map type ('value' key). I assume there is a generic logic to achieve this and just need help from someone more familiar with module code.
One way to achieve this is by adding a custom resolver by extending FieldItemTypeMap type:
extend type FieldItemTypeMap {
value: MapData
}
addFieldResolver('FieldItemTypeMap', 'value',
$builder->callback(function ($item) {
$values = $item->getValue();
return $values;
})
);
?>>
Active
1.0
Code