hook_domainrecords

Definition

hook_domainrecords(&$grants, $node)
API.php, line 59

Description

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/5 for more detail.

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

Namesort iconDescription
Domain hook functionsCore hooks for the Domain module suite.

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,         // If this value is > 0, then other grants will not be recorded
  );
  // Remove the domain_site grant.
  foreach ($grants as $key => $grant) {
    if ($grant['realm'] == 'domain_site') {
      unset($grants[$key]);
    }
  }
}