You are here

public function ContentEntityTypeResolver::applies in GraphQL 8.2

Same name and namespace in other branches
  1. 8 src/TypeResolver/ContentEntityTypeResolver.php \Drupal\graphql\TypeResolver\ContentEntityTypeResolver::applies()

Parameters

mixed $type:

Return value

bool

Overrides TypedDataTypeResolver::applies

File

src/TypeResolver/ContentEntityTypeResolver.php, line 68

Class

ContentEntityTypeResolver
Resolves the schema for content entities.

Namespace

Drupal\graphql\TypeResolver

Code

public function applies($type) {
  if ($type instanceof EntityDataDefinitionInterface) {
    $entityTypeId = $type
      ->getEntityTypeId();
    $entityType = $this->entityManager
      ->getDefinition($entityTypeId);
    return $entityType
      ->isSubclassOf('\\Drupal\\Core\\Entity\\ContentEntityInterface');
  }
  return FALSE;
}