forked from drupal-graphql/graphql
-
Notifications
You must be signed in to change notification settings - Fork 0
/
graphql.install
36 lines (32 loc) · 1.15 KB
/
graphql.install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
/**
* Implements hook_requirements().
*/
function graphql_requirements($phase) {
// This is the first reference into the library performed by the module.
$libraryAvailable = class_exists('\GraphQL\GraphQL');
$libraryArg = [
'@library' => 'webonyx/graphql-php',
];
return [
'graphql' => [
'title' => 'GraphQL',
'description' => !empty($libraryAvailable) ? t('@library component available', $libraryArg) : t('@library component not found', $libraryArg),
'severity' => !empty($libraryAvailable) ? REQUIREMENT_OK : REQUIREMENT_ERROR,
],
];
}
/**
* Implements hook_uninstall().
*/
function graphql_uninstall() {
// Remove the config keys set in GraphQLConfigOverrides::loadOverrides().
/** @var \Drupal\Core\Config\ConfigFactoryInterface $configFactory */
$configFactory = \Drupal::getContainer()->get('config.factory');
$languageTypes = $configFactory->getEditable('language.types');
$negotiation = $languageTypes->get('negotiation');
foreach (array_keys($negotiation) as $type) {
unset($negotiation[$type]['enabled']['language-graphql']);
}
$languageTypes->set('negotiation', $negotiation)->save();
}