function message_banner_update_8001 in Message Banner 8
Assign the new 'view message banner' permission to default roles.
File
- ./
message_banner.install, line 24
Code
function message_banner_update_8001() {
$role_storage = Drupal::entityTypeManager()
->getStorage('user_role');
$roles = [
'authenticated',
'anonymous',
];
foreach ($roles as $role) {
$role = $role_storage
->load($role);
$role
->grantPermission('view message banner');
$role
->save();
}
}