outline-8.x-1.x-dev/modules/outline_graphql/src/Plugin/GraphQL/DataProducer/Entry/ReferencedEntityUuid.php
modules/outline_graphql/src/Plugin/GraphQL/DataProducer/Entry/ReferencedEntityUuid.php
<?php
namespace Drupal\outline_graphql\Plugin\GraphQL\DataProducer\Entry;
use Drupal\Core\Entity\EntityInterface;
use Drupal\graphql\Plugin\GraphQL\DataProducer\DataProducerPluginBase;
/**
* @DataProducer(
* id = "referenced_entity_uuid",
* name = @Translation("Referenced Entity UUID"),
* description = @Translation("Returns the referenced entity's UUID of an entry."),
* produces = @ContextDefinition("string",
* label = @Translation("Referenced Entity UUID")
* ),
* consumes = {
* "entity" = @ContextDefinition("entity",
* label = @Translation("Entity")
* )
* }
* )
*/
class ReferencedEntityUuid extends DataProducerPluginBase {
/**
* @param \Drupal\Core\Entity\EntityInterface $entity
*
* @return string
*/
public function resolve(EntityInterface $entity) {
return $entity->getReferencedEntityUuid();
}
}
