You are here

public function ResolverHelperTrait::fromEntityReferenceRevisions in Thunder 6.2.x

Produces an entity_reference_revisions field.

Parameters

string $field: Name of the filed.

\Drupal\graphql\GraphQL\Resolver\ResolverInterface|null $entity: Entity to get the field property.

Return value

\Drupal\graphql\Plugin\GraphQL\DataProducer\DataProducerProxy The field data producer.

1 call to ResolverHelperTrait::fromEntityReferenceRevisions()
ThunderPagesSchemaExtension::resolveFields in modules/thunder_gqls/src/Plugin/GraphQL/SchemaExtension/ThunderPagesSchemaExtension.php
Add article field resolvers.

File

modules/thunder_gqls/src/Traits/ResolverHelperTrait.php, line 78

Class

ResolverHelperTrait
Helper functions for field resolvers.

Namespace

Drupal\thunder_gqls\Traits

Code

public function fromEntityReferenceRevisions(string $field, $entity = NULL) {
  return $this->builder
    ->produce('entity_reference_revisions')
    ->map('field', $this->builder
    ->fromValue($field))
    ->map('entity', $entity ?: $this->builder
    ->fromParent())
    ->map('language', $this->builder
    ->fromPath('entity', 'langcode.value', $this->builder
    ->fromParent()));
}