class GraphQLConfigOverrides in GraphQL 8.3
GraphQL config overrides.
Enforce the GraphQL language negotiation always to be on top.
Hierarchy
- class \Drupal\graphql\Config\GraphQLConfigOverrides implements ConfigFactoryOverrideInterface
Expanded class hierarchy of GraphQLConfigOverrides
1 string reference to 'GraphQLConfigOverrides'
1 service uses GraphQLConfigOverrides
File
- src/
Config/ GraphQLConfigOverrides.php, line 15
Namespace
Drupal\graphql\ConfigView source
class GraphQLConfigOverrides implements ConfigFactoryOverrideInterface {
/**
* The config storage service.
*
* @var \Drupal\Core\Config\StorageInterface
*/
protected $baseStorage;
/**
* The negotiator manager service.
*
* @var \Drupal\language\LanguageNegotiationMethodManager|null
*/
protected $negotiatorManager;
/**
* GraphQLConfigOverrides constructor.
*
* @param \Drupal\Core\Config\StorageInterface $storage
* The config storage service.
* @param \Drupal\language\LanguageNegotiationMethodManager|null $negotiatorManager
*/
public function __construct(StorageInterface $storage, LanguageNegotiationMethodManager $negotiatorManager = NULL) {
$this->baseStorage = $storage;
$this->negotiatorManager = $negotiatorManager;
}
/**
* {@inheritdoc}
*/
public function loadOverrides($names) {
if ($this->negotiatorManager && in_array('language.types', $names) && $this->negotiatorManager
->hasDefinition('language-graphql') && ($config = $this->baseStorage
->read('language.types'))) {
foreach (array_keys($config['negotiation']) as $type) {
$config['negotiation'][$type]['enabled']['language-graphql'] = -999;
asort($config['negotiation'][$type]['enabled']);
}
return [
'language.types' => $config,
];
}
return [];
}
/**
* {@inheritdoc}
*/
public function getCacheSuffix() {
return 'graphql';
}
/**
* {@inheritdoc}
*/
public function createConfigObject($name, $collection = StorageInterface::DEFAULT_COLLECTION) {
return NULL;
}
/**
* {@inheritdoc}
*/
public function getCacheableMetadata($name) {
return new CacheableMetadata();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
GraphQLConfigOverrides:: |
protected | property | The config storage service. | |
GraphQLConfigOverrides:: |
protected | property | The negotiator manager service. | |
GraphQLConfigOverrides:: |
public | function |
Creates a configuration object for use during install and synchronization. Overrides ConfigFactoryOverrideInterface:: |
|
GraphQLConfigOverrides:: |
public | function |
Gets the cacheability metadata associated with the config factory override. Overrides ConfigFactoryOverrideInterface:: |
|
GraphQLConfigOverrides:: |
public | function |
The string to append to the configuration static cache name. Overrides ConfigFactoryOverrideInterface:: |
|
GraphQLConfigOverrides:: |
public | function |
Returns config overrides. Overrides ConfigFactoryOverrideInterface:: |
|
GraphQLConfigOverrides:: |
public | function | GraphQLConfigOverrides constructor. |