You are here

public function LanguageTypeResolver::resolveRecursive in GraphQL 8

Same name and namespace in other branches
  1. 8.2 src/TypeResolver/LanguageTypeResolver.php \Drupal\graphql\TypeResolver\LanguageTypeResolver::resolveRecursive()

Parameters

mixed $type:

Return value

\Fubhy\GraphQL\Type\Definition\Types\TypeInterface|null

Overrides TypeResolverInterface::resolveRecursive

File

src/TypeResolver/LanguageTypeResolver.php, line 37

Class

LanguageTypeResolver
Resolves the schema for the 'language' data type.

Namespace

Drupal\graphql\TypeResolver

Code

public function resolveRecursive($type) {
  if ($type instanceof DataDefinitionInterface && $type
    ->getDataType() === 'language') {
    if (!isset($this->languageType)) {
      $this->languageType = new ObjectType('Language', [
        'id' => [
          'type' => new NonNullModifier(Type::idType()),
          'resolve' => [
            __CLASS__,
            'getId',
          ],
        ],
        'name' => [
          'type' => new NonNullModifier(Type::stringType()),
          'resolve' => [
            __CLASS__,
            'getName',
          ],
        ],
        'direction' => [
          'type' => new NonNullModifier(Type::stringType()),
          'resolve' => [
            __CLASS__,
            'getDirection',
          ],
        ],
        'weight' => [
          'type' => new NonNullModifier(Type::intType()),
          'resolve' => [
            __CLASS__,
            'getWeight',
          ],
        ],
        'locked' => [
          'type' => new NonNullModifier(Type::booleanType()),
          'resolve' => [
            __CLASS__,
            'isLocked',
          ],
        ],
        'default' => [
          'type' => new NonNullModifier(Type::booleanType()),
          'resolve' => [
            __CLASS__,
            'isDefault',
          ],
        ],
      ]);
    }
    return $this->languageType;
  }
  return NULL;
}