thunder_translation.install in Thunder 8.5
Thunder Translation install hooks.
File
modules/thunder_translation/thunder_translation.installView source
<?php
/**
* @file
* Thunder Translation install hooks.
*/
use Drupal\Core\Entity\EntityStorageException;
use Drupal\user\Entity\Role;
/**
* Implements hook_install().
*/
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) {
}
}
}
/* hook_update_n implementations should be in the profile instead of this
submodule. */
Functions
Name![]() |
Description |
---|---|
thunder_translation_install | Implements hook_install(). |