You are here

function message_banner_install in Message Banner 8

Implements hook_install().

File

./message_banner.install, line 10

Code

function message_banner_install() {
  $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();
  }
}