function thunder_translation_install in Thunder 6.2.x
Same name and namespace in other branches
- 8.5 modules/thunder_translation/thunder_translation.install \thunder_translation_install()
- 6.0.x modules/thunder_translation/thunder_translation.install \thunder_translation_install()
- 6.1.x modules/thunder_translation/thunder_translation.install \thunder_translation_install()
Implements hook_install().
File
- modules/
thunder_translation/ thunder_translation.install, line 14 - Thunder Translation install hooks.
Code
function thunder_translation_install() {
/** @var \Drupal\user\Entity\Role[] $roles */
$roles = Role::loadMultiple([
'editor',
'seo',
'restricted_editor',
]);
foreach ($roles as $role) {
try {
$role
->grantPermission('create content translations');
$role
->grantPermission('update content translations');
$role
->grantPermission('translate any entity');
if (in_array($role
->id(), [
'editor',
'seo',
])) {
$role
->grantPermission('delete content translations');
}
$role
->save();
} catch (EntityStorageException $storageException) {
}
}
}