You are here

function pbf_install in Permissions by field 8

Implements hook_install().

File

./pbf.install, line 13
Permissions by field install file.

Code

function pbf_install() {
  $config = \Drupal::configFactory()
    ->getEditable('pbf.settings');
  $roles_gids = array();
  $roles = Role::loadMultiple();
  $i = 1;
  foreach ($roles as $role) {
    $roles_gids[$i] = $role
      ->id();
    $i++;
  }
  $config
    ->set('pbf_roles_gids', array_flip($roles_gids));
  $config
    ->save();
}