outline-8.x-1.x-dev/modules/outline_graphql/src/Plugin/GraphQL/DataProducer/Entry/Children.php
modules/outline_graphql/src/Plugin/GraphQL/DataProducer/Entry/Children.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_children",
* name = @Translation("Entry children"),
* description = @Translation("Returns the children of an outline entry."),
* produces = @ContextDefinition("any",
* label = @Translation("Children")
* ),
* consumes = {
* "entity" = @ContextDefinition("entity",
* label = @Translation("Entity")
* )
* }
* )
*/
class Children extends DataProducerPluginBase {
/**
* @param \Drupal\Core\Entity\EntityInterface $entity
*
* @return mixed
*/
public function resolve(EntityInterface $entity) {
return $entity->getChildren();
}
}
