You are here

protected function ResolverHelperTrait::addFieldResolverIfNotExists in Thunder 6.2.x

Add field resolver to registry, if it does not already exist.

Parameters

string $type: The type name.

string $field: The field name.

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

14 calls to ResolverHelperTrait::addFieldResolverIfNotExists()
ResolverHelperTrait::addSimpleCallbackFields in modules/thunder_gqls/src/Traits/ResolverHelperTrait.php
Define callback field resolver for a type.
ThunderBreadcrumbSchemaExtension::registerResolvers in modules/thunder_gqls/src/Plugin/GraphQL/SchemaExtension/ThunderBreadcrumbSchemaExtension.php
ThunderJsonLdSchemaExtension::registerResolvers in modules/thunder_gqls/src/Plugin/GraphQL/SchemaExtension/ThunderJsonLdSchemaExtension.php
ThunderMediaSchemaExtension::resolveFields in modules/thunder_gqls/src/Plugin/GraphQL/SchemaExtension/ThunderMediaSchemaExtension.php
Add image media field resolvers.
ThunderMenuSchemaExtension::registerResolvers in modules/thunder_gqls/src/Plugin/GraphQL/SchemaExtension/ThunderMenuSchemaExtension.php

... See full list

File

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

Class

ResolverHelperTrait
Helper functions for field resolvers.

Namespace

Drupal\thunder_gqls\Traits

Code

protected function addFieldResolverIfNotExists(string $type, string $field, ResolverInterface $resolver) {
  if (!$this->registry
    ->getFieldResolver($type, $field)) {
    $this->registry
      ->addFieldResolver($type, $field, $resolver);
  }
}