You are here

public function ResolverHelperTrait::fromRoute in Thunder 6.2.x

Produces an entity from a given path.

Parameters

\Drupal\graphql\GraphQL\Resolver\ResolverInterface $path: The path resolver.

Return value

\Drupal\graphql\GraphQL\Resolver\ResolverInterface The resolved entity.

3 calls to ResolverHelperTrait::fromRoute()
ThunderMenuSchemaExtension::registerResolvers in modules/thunder_gqls/src/Plugin/GraphQL/SchemaExtension/ThunderMenuSchemaExtension.php
ThunderMetaTagsSchemaExtension::registerResolvers in modules/thunder_gqls/src/Plugin/GraphQL/SchemaExtension/ThunderMetaTagsSchemaExtension.php
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 112

Class

ResolverHelperTrait
Helper functions for field resolvers.

Namespace

Drupal\thunder_gqls\Traits

Code

public function fromRoute(ResolverInterface $path) {
  return $this->builder
    ->compose($this->builder
    ->produce('route_load')
    ->map('path', $path), $this->builder
    ->produce('route_entity')
    ->map('url', $this->builder
    ->fromParent())
    ->map('language', $this->builder
    ->produce('thunder_entity_sub_request')
    ->map('path', $path)
    ->map('key', $this->builder
    ->fromValue('language'))));
}