drupal-graphql / drupal-graphql/graphql
How to use $builder->context and $builder->fromContext
- Dominant language
- PHP
- Stars
- 287
- Forks
- 198
- PR merge metrics
- No merged PRs in 30d
Description
There doesn't seems to be any documentation for this but the comments it seems to suggest you can set a context in one resolver and retrieve that value later on in another resolver, i was hoping something like the following but it doesn't work
```
$registry->addFieldResolver(
'ImageGridParagraph', 'style',
$builder->compose(
$builder->produce('property_path')
->map('type', $builder->fromValue('entity:paragraph'))
->map('value', $builder->fromParent())
->map('path', $builder->fromValue('field_image_focal_point_styles.value')),
$builder->context(
'image-grid-style', $builder->fromParent()
),
)
);
```
```
$registry->addFieldResolver(
'Image', 'parentStyle',
$builder->compose(
$builder->fromContext('image-grid-style'),
)
);
```
I want to pass a value a couple of levels down a nested structure
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.