Skip to content

Commit 96391df

Browse files
authored
Fixing error in case the language module is missing. (#836)
1 parent 0cd8dfb commit 96391df

1 file changed

Lines changed: 11 additions & 12 deletions

File tree

src/Config/LanguageConfigOverride.php

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,20 +45,19 @@ public function __construct(StorageInterface $storage, LanguageNegotiationMethod
4545
* {@inheritdoc}
4646
*/
4747
public function loadOverrides($names) {
48-
$method = OperationLanguageNegotiation::METHOD_ID;
48+
// We can't use the static property of the negotiation method here because
49+
// the language module might not be enabled.
50+
$method = 'language-graphql-operation';
4951

50-
if (
51-
$this->negotiatorManager &&
52-
in_array('language.types', $names)
53-
&& $this->negotiatorManager->hasDefinition($method)
54-
&& $config = $this->baseStorage->read('language.types')
55-
) {
56-
foreach (array_keys($config['negotiation']) as $type) {
57-
$config['negotiation'][$type]['enabled'][$method] = -999;
58-
asort($config['negotiation'][$type]['enabled']);
59-
}
52+
if ($this->negotiatorManager && in_array('language.types', $names)) {
53+
if ($this->negotiatorManager->hasDefinition($method) && $config = $this->baseStorage->read('language.types')) {
54+
foreach (array_keys($config['negotiation']) as $type) {
55+
$config['negotiation'][$type]['enabled'][$method] = -999;
56+
asort($config['negotiation'][$type]['enabled']);
57+
}
6058

61-
return ['language.types' => $config];
59+
return ['language.types' => $config];
60+
}
6261
}
6362

6463
return [];

0 commit comments

Comments
 (0)