pbf.install in Permissions by field 8
Permissions by field install file.
File
pbf.installView source
<?php
/**
* @file
* Permissions by field install file.
*/
use Drupal\user\Entity\Role;
/**
* Implements hook_install().
*/
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();
}
Functions
Name | Description |
---|---|
pbf_install | Implements hook_install(). |