EntityPublished.php in GraphQL 8.3
File
modules/graphql_core/src/Plugin/GraphQL/Fields/Entity/EntityPublished.phpView source
<?php
namespace Drupal\graphql_core\Plugin\GraphQL\Fields\Entity;
use Drupal\Core\Entity\EntityPublishedInterface;
use Drupal\graphql\GraphQL\Execution\ResolveContext;
use Drupal\graphql\Plugin\GraphQL\Fields\FieldPluginBase;
use GraphQL\Type\Definition\ResolveInfo;
/**
* @GraphQLField(
* id = "entity_published",
* secure = true,
* name = "entityPublished",
* type = "Boolean",
* parents = {"EntityPublishable"}
* )
*/
class EntityPublished extends FieldPluginBase {
/**
* {@inheritdoc}
*/
protected function resolveValues($value, array $args, ResolveContext $context, ResolveInfo $info) {
if ($value instanceof EntityPublishedInterface) {
(yield $value
->isPublished());
}
}
}
Classes
Name | Description |
---|---|
EntityPublished | Plugin annotation @GraphQLField( id = "entity_published", secure = true, name = "entityPublished", type = "Boolean", parents = {"EntityPublishable"} ) |