1 node_test.module node_test_node_access_records_alter(&$grants, Node $node)

Implements hook_node_access_records_alter().

File

core/modules/node/tests/node_test/node_test.module, line 106
A dummy module for testing node related hooks.

Code

function node_test_node_access_records_alter(&$grants, Node $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_page_realm' && $node->promote) {
        $grants[$key]['realm'] = 'test_alter_realm';
        $grants[$key]['gid'] = 2;
      }
    }
  }
}