social_graphql.install in Open Social 10.3.x
Same filename and directory in other branches
Install, update and uninstall functions for the social_graphql module.
File
modules/custom/social_graphql/social_graphql.installView source
<?php
/**
* @file
* Install, update and uninstall functions for the social_graphql module.
*/
/**
* Implements hook_install().
*/
function social_graphql_install() {
// Ensure users can use GraphQL powered applications with our default server.
// We rely on normal access rules for authorization.
user_role_grant_permissions('anonymous', [
'execute open_social_graphql arbitrary graphql requests',
]);
user_role_grant_permissions('authenticated', [
'execute open_social_graphql arbitrary graphql requests',
]);
// GraphQL resolvers require the entity access API for proper access checks in
// queries, so we enable the setting when this module is installed.
$config = \Drupal::configFactory()
->getEditable('social_core.settings');
$config
->set('use_entity_access_api', 1)
->save();
}
/**
* Implements hook_update_dependencies().
*/
function social_graphql_update_dependencies() {
// Run the update hook only after an update hook in social_core.
$dependencies['social_graphql'][8901] = [
'social_core' => 10103,
];
return $dependencies;
}
/**
* Opt-in to the new entity access API.
*/
function social_graphql_update_10101() {
$config = \Drupal::configFactory()
->getEditable('social_core.settings');
$config
->set('use_entity_access_api', 1)
->save();
}
Functions
Name![]() |
Description |
---|---|
social_graphql_install | Implements hook_install(). |
social_graphql_update_10101 | Opt-in to the new entity access API. |
social_graphql_update_dependencies | Implements hook_update_dependencies(). |