outline-8.x-1.x-dev/modules/outline_graphql/src/Plugin/GraphQL/DataProducer/Outline/RootEid.php
modules/outline_graphql/src/Plugin/GraphQL/DataProducer/Outline/RootEid.php
<?php
namespace Drupal\outline_graphql\Plugin\GraphQL\DataProducer\Outline;
use Drupal\Core\Entity\EntityInterface;
use Drupal\graphql\Plugin\GraphQL\DataProducer\DataProducerPluginBase;
use Drupal\outline\Entity\Outline;
/**
* @DataProducer(
* id = "root_eid",
* name = @Translation("Root Entry ID"),
* description = @Translation("Returns the root entry identifier."),
* produces = @ContextDefinition("integer",
* label = @Translation("Identifier")
* ),
* consumes = {
* "entity" = @ContextDefinition("entity",
* label = @Translation("Entity")
* )
* }
* )
*/
class RootEid extends DataProducerPluginBase {
/**
* @param \Drupal\outline\Entity\Outline $outline
*
* @return mixed
*/
public function resolve(Outline $outline) {
return $outline->getRootEntryId();
}
}
