outline-8.x-1.x-dev/modules/outline_graphql/src/Plugin/GraphQL/DataProducer/Entry/ReferencedEntityDisplay.php
modules/outline_graphql/src/Plugin/GraphQL/DataProducer/Entry/ReferencedEntityDisplay.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_display",
* name = @Translation("Referenced Entity Display"),
* description = @Translation("Returns the referenced entity's display of an entry."),
* produces = @ContextDefinition("string",
* label = @Translation("Referenced Entity Display")
* ),
* consumes = {
* "entity" = @ContextDefinition("entity",
* label = @Translation("Entity")
* )
* }
* )
*/
class ReferencedEntityDisplay extends DataProducerPluginBase {
/**
* @param \Drupal\Core\Entity\EntityInterface $entity
*
* @return string
*/
public function resolve(EntityInterface $entity) {
return $entity->getReferencedEntityDisplay();
}
}
