function thunder_update_8111 in Thunder 8.2
Adjust permissions related to "video_embed_field" module.
File
- ./
thunder.install, line 659 - Install, update and uninstall functions for the thunder installation profile.
Code
function thunder_update_8111() {
/** @var \Drupal\update_helper\UpdateLogger $updateLogger */
$updateLogger = \Drupal::service('update_helper.logger');
// Granting permissions only for "editor" and "seo" user roles.
$roles = Role::loadMultiple([
'editor',
'seo',
]);
foreach ($roles as $role) {
try {
$role
->grantPermission('never autoplay videos');
$role
->save();
$updateLogger
->info(t('Permission for never autoplay videos is granted for @user_role user role.', [
'@user_role' => $role
->id(),
]));
} catch (EntityStorageException $storageException) {
$updateLogger
->warning(t('Unable to change permissions for @user_role user role.', [
'@user_role' => $role
->id(),
]));
}
}
// Output logged result of update hook execution.
return $updateLogger
->output();
}