You are here

abstract class SubscriptionPluginBase in GraphQL 8.3

Hierarchy

Expanded class hierarchy of SubscriptionPluginBase

1 file declares its use of SubscriptionPluginBase
MockGraphQLPluginTrait.php in tests/src/Traits/MockGraphQLPluginTrait.php

File

src/Plugin/GraphQL/Subscriptions/SubscriptionPluginBase.php, line 14

Namespace

Drupal\graphql\Plugin\GraphQL\Subscriptions
View source
abstract class SubscriptionPluginBase extends PluginBase implements SubscriptionPluginInterface {
  use TypedPluginTrait;
  use DescribablePluginTrait;
  use ArgumentAwarePluginTrait;
  use DeprecatablePluginTrait;

  /**
   * {@inheritdoc}
   */
  public static function createInstance(SchemaBuilderInterface $builder, SubscriptionPluginManager $manager, $definition, $id) {
    return [
      'description' => $definition['description'],
      'deprecationReason' => $definition['deprecationReason'],
      'type' => $builder
        ->processType($definition['type']),
      'args' => $builder
        ->processArguments($definition['args']),
      'resolve' => function ($value, $args, $context, $info) use ($manager, $id) {
        $instance = $manager
          ->getInstance([
          'id' => $id,
        ]);
        return call_user_func_array([
          $instance,
          'resolve',
        ], [
          $value,
          $args,
          $context,
          $info,
        ]);
      },
    ];
  }

  /**
   * {@inheritdoc}
   */
  public function getDefinition() {
    $definition = $this
      ->getPluginDefinition();
    return [
      'type' => $this
        ->buildType($definition),
      'description' => $this
        ->buildDescription($definition),
      'args' => $this
        ->buildArguments($definition),
      'deprecationReason' => $this
        ->buildDeprecationReason($definition),
    ];
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ArgumentAwarePluginTrait::buildArgumentDefault protected function Builds an argument's default value.
ArgumentAwarePluginTrait::buildArgumentDescription protected function Builds an argument's description.
ArgumentAwarePluginTrait::buildArguments protected function Builds the list of arguments.
ArgumentAwarePluginTrait::buildArgumentType protected function Builds an argument's type.
DeprecatablePluginTrait::buildDeprecationReason protected function
DescribablePluginTrait::buildDescription protected function
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
PluginBase::$pluginDefinition protected property The plugin implementation definition. 1
PluginBase::$pluginId protected property The plugin_id.
PluginBase::DERIVATIVE_SEPARATOR constant A string which is used to separate base plugin IDs from the derivative ID.
PluginBase::getBaseId public function Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface::getBaseId
PluginBase::getDerivativeId public function Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface::getDerivativeId
PluginBase::getPluginDefinition public function Gets the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition 3
PluginBase::getPluginId public function Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface::getPluginId
PluginBase::isConfigurable public function Determines if the plugin is configurable.
PluginBase::__construct public function Constructs a \Drupal\Component\Plugin\PluginBase object. 92
SubscriptionPluginBase::createInstance public static function Overrides SubscriptionPluginInterface::createInstance
SubscriptionPluginBase::getDefinition public function Returns the plugin's type or field definition for the schema. Overrides SubscriptionPluginInterface::getDefinition
TypedPluginTrait::buildType protected function