function node_limit_role_user_role_delete in Node Limit 8
Same name and namespace in other branches
- 7 node_limit_role/node_limit_role.module \node_limit_role_user_role_delete()
Implements hook_user_role_delete().
Delete all rules related to the role being deleted.
File
- old/
node_limit_role/ node_limit_role.module, line 13 - Module to restrict the number of nodes by role.
Code
function node_limit_role_user_role_delete($role) {
$limits = \Drupal::database()
->select('node_limit_role', 'src')
->fields('src', array(
'lid',
))
->condition('rid', $role->rid)
->execute();
$lids = array();
foreach ($limits as $limit) {
$lids[] = $limit->lid;
}
node_limit_delete($lids);
}