You are here

public function EntityDescription::resolve in GraphQL 8.4

Resolver.

Parameters

\Drupal\Core\Entity\EntityInterface $entity:

Return value

string|null

File

src/Plugin/GraphQL/DataProducer/Entity/EntityDescription.php, line 35

Class

EntityDescription
Returns the description text of an entity.

Namespace

Drupal\graphql\Plugin\GraphQL\DataProducer\Entity

Code

public function resolve(EntityInterface $entity) {
  if ($entity instanceof EntityDescriptionInterface) {
    return $entity
      ->getDescription();
  }
  return NULL;
}