function acl_node_test_node_access_records_alter in ACL 8
Same name and namespace in other branches
- 7 tests/acl_node_test.module \acl_node_test_node_access_records_alter()
Implements hook_node_access_records_alter().
File
- tests/
modules/ acl_node_test/ acl_node_test.module, line 58 - Dummy module implementing node related hooks to test API interaction with the Node module.
Code
function acl_node_test_node_access_records_alter(&$grants, NodeInterface $node) {
if (!empty($grants)) {
foreach ($grants as $key => $grant) {
// Alter grant from test_page_realm to test_alter_realm and modify the gid.
if ($grant['realm'] == 'test_test_alter_realm' && $node
->isPromoted()) {
$grants[$key]['realm'] = 'test_alter_realm';
$grants[$key]['gid'] = 2;
}
}
}
}