You are here

protected function RouteEntity::resolveEntityTranslation in GraphQL 8.3

Resolves the entity translation from the given url context.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity to resolve.

\Drupal\Core\Url $url: The url of the entity to resolve.

array $args: The field arguments array.

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

Return value

\Iterator

1 call to RouteEntity::resolveEntityTranslation()
RouteEntity::resolveValues in modules/graphql_core/src/Plugin/GraphQL/Fields/Routing/RouteEntity.php
Retrieve the list of field values.

File

modules/graphql_core/src/Plugin/GraphQL/Fields/Routing/RouteEntity.php, line 161

Class

RouteEntity
Retrieve the current routes entity, if it is an entity route.

Namespace

Drupal\graphql_core\Plugin\GraphQL\Fields\Routing

Code

protected function resolveEntityTranslation(EntityInterface $entity, Url $url, array $args, ResolveInfo $info) {
  if ($entity instanceof TranslatableInterface && isset($args['language']) && $entity
    ->isTranslatable()) {
    if ($entity
      ->hasTranslation($args['language'])) {
      $entity = $entity
        ->getTranslation($args['language']);
    }
  }
  return $this
    ->resolveEntity($entity, $url, $args, $info);
}