You are here

function revisioning_node_access_records_alter in Revisioning 7

Implements hook_node_access_records_alter().

If the node is not the current node this function clears the grants array and rebuilds it using the current node.

File

./revisioning.module, line 747
Allows content to be updated and reviewed before submitting it for publication, while the current live revision remains unchanged and publicly visible until the changes have been reviewed and found fit for publication by a moderator.

Code

function revisioning_node_access_records_alter(&$grants, $node) {
  if (!revisioning_revision_is_current($node)) {
    $current_node = node_load($node->nid, NULL, TRUE);
    $grants = array();
    foreach (module_implements('node_access_records') as $module) {
      $function = $module . '_node_access_records';
      if (function_exists($function)) {
        $result = call_user_func_array($function, array(
          $current_node,
        ));
        if (isset($result)) {
          if (is_array($result)) {
            $grants = array_merge_recursive($grants, $result);
          }
          else {
            $grants[] = $result;
          }
        }
      }
    }
  }
}