You are here

PersistedQueryPluginManager.php in GraphQL 8.4

File

src/Plugin/PersistedQueryPluginManager.php
View source
<?php

namespace Drupal\graphql\Plugin;

use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Plugin\DefaultPluginManager;

/**
 * Collects persisted queries that are defined as plugins.
 */
class PersistedQueryPluginManager extends DefaultPluginManager {

  /**
   * PersistedQueryPluginManager constructor.
   *
   * @param bool|string $pluginSubdirectory
   *   The plugin's subdirectory.
   * @param \Traversable $namespaces
   *   An object that implements \Traversable which contains the root paths
   *   keyed by the corresponding namespace to look for plugin implementations.
   * @param \Drupal\Core\Extension\ModuleHandlerInterface $moduleHandler
   *   The module handler.
   * @param \Drupal\Core\Cache\CacheBackendInterface $definitionCacheBackend
   * @param string|null $pluginInterface
   *   The interface each plugin should implement.
   * @param string $pluginAnnotationName
   *   The name of the annotation that contains the plugin definition.
   * @param array $config
   *   The configuration service parameter.
   */
  public function __construct($pluginSubdirectory, \Traversable $namespaces, ModuleHandlerInterface $moduleHandler, CacheBackendInterface $definitionCacheBackend, $pluginInterface, $pluginAnnotationName, array $config) {
    parent::__construct($pluginSubdirectory, $namespaces, $moduleHandler, $pluginInterface, $pluginAnnotationName);
    $this
      ->alterInfo('graphql_persisted_query');
    $this
      ->useCaches(empty($config['development']));
    $this
      ->setCacheBackend($definitionCacheBackend, 'graphql_persisted_query', [
      'graphql_persisted_query',
    ]);
  }

}

Classes

Namesort descending Description
PersistedQueryPluginManager Collects persisted queries that are defined as plugins.