You are here

protected function ThunderParagraphsSchemaExtension::resolveParagraphTypes in Thunder 6.2.x

Resolves page types.

Parameters

mixed $value: The current value.

\Drupal\graphql\GraphQL\Execution\ResolveContext $context: The resolve context.

\GraphQL\Type\Definition\ResolveInfo $info: The resolve information.

Return value

string Response type.

Throws

\Exception

File

modules/thunder_gqls/src/Plugin/GraphQL/SchemaExtension/ThunderParagraphsSchemaExtension.php, line 134

Class

ThunderParagraphsSchemaExtension
The paragraph schema extension.

Namespace

Drupal\thunder_gqls\Plugin\GraphQL\SchemaExtension

Code

protected function resolveParagraphTypes($value, ResolveContext $context, ResolveInfo $info) : string {
  if ($value instanceof ParagraphInterface) {
    return 'Paragraph' . $this
      ->mapBundleToSchemaName($value
      ->bundle());
  }
  throw new \Exception('Invalid paragraph type.');
}