You are here

function hook_domainrecords in Domain Access 6.2

Same name and namespace in other branches
  1. 5 API.php \hook_domainrecords()

Notify other modules that we are saving node access records.

This hook allows Domain Access modules to overwrite the default bahaviors. See http://api.drupal.org/api/function/hook_node_access_records/6 for more detail.

Note: In Drupal 7, this is a core feature.

Parameters

&$grants: The existing default $grants, passed by reference.

$node: The node object being saved.

Return value

No return value. Modify the $grants array, passed by reference.

Related topics

2 invocations of hook_domainrecords()
domain_content_update_nodes in domain_content/domain_content.module
Abstraction function that lets us update access rules.
domain_node_access_records in ./domain.module
Implement hook_node_access_records()

File

./API.php, line 62
API documentation file.

Code

function hook_domainrecords(&$grants, $node) {

  // Add a sample access record to let a user see their content at all times.
  $grants[] = array(
    'realm' => 'domain_example',
    'gid' => $node->uid,
    'grant_view' => TRUE,
    'grant_update' => TRUE,
    'grant_delete' => TRUE,
    'priority' => 0,
  );

  // Remove the domain_site grant.
  foreach ($grants as $key => $grant) {
    if ($grant['realm'] == 'domain_site') {
      unset($grants[$key]);
    }
  }
}