outline-8.x-1.x-dev/modules/outline_graphql/src/Plugin/GraphQL/DataProducer/Entry/Content.php
modules/outline_graphql/src/Plugin/GraphQL/DataProducer/Entry/Content.php
<?php
namespace Drupal\outline_graphql\Plugin\GraphQL\DataProducer\Entry;
use Drupal\Core\Entity\EntityInterface;
use Drupal\graphql\Plugin\GraphQL\DataProducer\DataProducerPluginBase;
/**
* @DataProducer(
* id = "entry_content",
* name = @Translation("Entry content"),
* description = @Translation("Returns the ccntent of an outline entry."),
* produces = @ContextDefinition("any",
* label = @Translation("Content")
* ),
* consumes = {
* "entity" = @ContextDefinition("entity",
* label = @Translation("Entity")
* )
* }
* )
*/
class Content extends DataProducerPluginBase {
/**
* @param \Drupal\Core\Entity\EntityInterface $entity
*
* @return mixed
*/
public function resolve(EntityInterface $entity) {
return $entity->getContent();
}
}
