function book_access_user_role_insert in Book access 1.x
Same name and namespace in other branches
- 7.2 book_access.module \book_access_user_role_insert()
Implements hook_ENTITY_TYPE_insert() for user_role.
Makes sure to set default visibility when a new role is created.
File
- ./
book_access.module, line 18
Code
function book_access_user_role_insert(EntityInterface $entity) {
/** @var \Drupal\user\RoleInterface $role */
$role = $entity;
/** @var \Drupal\book_access\BookAccessHelper $book_helper */
$book_helper = \Drupal::service('book_access.book_access_helper');
$book_helper
->setDefaultForRole($role);
}