outline-8.x-1.x-dev/modules/outline_graphql/src/Plugin/GraphQL/DataProducer/Entry/ParentEid.php

modules/outline_graphql/src/Plugin/GraphQL/DataProducer/Entry/ParentEid.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_parent_eid",
 *   name = @Translation("Entry's parent entry id"),
 *   description = @Translation("Returns the parent entry id of an entry."),
 *   produces = @ContextDefinition("string",
 *     label = @Translation("Parent Entry ID")
 *   ),
 *   consumes = {
 *     "entity" = @ContextDefinition("entity",
 *       label = @Translation("Entity")
 *     )
 *   }
 * )
 */
class ParentEid extends DataProducerPluginBase {

  /**
   * @param \Drupal\Core\Entity\EntityInterface $entity
   *
   * @return integer
   */
  public function resolve(EntityInterface $entity) {
    return $entity->getParentEid();
  }

}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc