You are here

protected function ThunderMediaSchemaExtension::resolveMediaTypes in Thunder 6.2.x

Resolves media 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/ThunderMediaSchemaExtension.php, line 151

Class

ThunderMediaSchemaExtension
The media schema extension.

Namespace

Drupal\thunder_gqls\Plugin\GraphQL\SchemaExtension

Code

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