function forum_access_node_grants in Forum Access 8
Same name and namespace in other branches
- 5 forum_access.module \forum_access_node_grants()
- 6 forum_access.module \forum_access_node_grants()
- 7 forum_access.module \forum_access_node_grants()
Implements hook_node_grants().
This function supplies the forum access grants. forum_access simply uses roles as ACLs, so rids translate directly to gids.
@inheritdoc
File
- ./
forum_access.module, line 62 - Contains forum_access.module.
Code
function forum_access_node_grants(AccountInterface $account, $op) {
$roles_gids = \Drupal::configFactory()
->getEditable('forum_access.settings')
->get('forum_access_roles_gids');
$grants = [];
/** @var string $role */
foreach ($account
->getRoles() as $role) {
$grants['forum_access'][] = $roles_gids[$role];
}
return $grants;
}