You are here

public function EntityPublished::resolve in GraphQL 8.4

Resolver.

Parameters

\Drupal\Core\Entity\EntityInterface $entity:

Return value

bool|null

File

src/Plugin/GraphQL/DataProducer/Entity/EntityPublished.php, line 36

Class

EntityPublished
Returns whether the entity is published.

Namespace

Drupal\graphql\Plugin\GraphQL\DataProducer\Entity

Code

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