public function Server::getPersistedQueryInstances in GraphQL 8.4
Returns the current persisted queries set.
Return value
\Drupal\graphql\Plugin\PersistedQueryPluginInterface[]
Overrides ServerInterface::getPersistedQueryInstances
4 calls to Server::getPersistedQueryInstances()
- Server::addPersistedQueryInstance in src/
Entity/ Server.php - Adds a Persisted Query plugin instance to the persisted queries set.
- Server::getSortedPersistedQueryInstances in src/
Entity/ Server.php - Returns the current persisted queries set, sorted by the plugins weight.
- Server::preSave in src/
Entity/ Server.php - Acts on an entity before the presave hook is invoked.
- Server::removePersistedQueryInstance in src/
Entity/ Server.php - Removes a Persisted Query plugin instance from the persisted queries set.
File
- src/
Entity/ Server.php, line 409
Class
- Server
- The main GraphQL configuration and request entry point.
Namespace
Drupal\graphql\EntityCode
public function getPersistedQueryInstances() {
if (!is_null($this->persisted_query_instances)) {
return $this->persisted_query_instances;
}
/** @var \Drupal\graphql\Plugin\PersistedQueryPluginManager $plugin_manager */
$plugin_manager = \Drupal::service('plugin.manager.graphql.persisted_query');
$definitions = $plugin_manager
->getDefinitions();
$persisted_queries_settings = $this
->get('persisted_queries_settings');
foreach ($definitions as $id => $definition) {
if (isset($persisted_queries_settings[$id])) {
$configuration = !empty($persisted_queries_settings[$id]) ? $persisted_queries_settings[$id] : [];
$this->persisted_query_instances[$id] = $plugin_manager
->createInstance($id, $configuration);
}
}
return $this->persisted_query_instances;
}