You are here

function module_grants_set_node_access_implementations in Module Grants 7

Get/Set node access implementations in static and cache

See also

module_implements()

3 calls to module_grants_set_node_access_implementations()
ModuleGrantsBasicTestCase::testModuleImplementsHook in ./module_grants.test
module_grants_invoke_node_access in ./module_grants.module
Replicate node.module's $access = module_invoke_all('node_access', $node, $op, $account), using the hook_node_access() saved in module_grants_set_node_access_implementations()
module_grants_module_implements_alter in ./module_grants.module
Implement hook_module_implements_alter: 1. Save other modules' hook_node_access, remove them so that only our hook is left 2. Remove node.module's hook_query_alter

File

./module_grants.module, line 73

Code

function module_grants_set_node_access_implementations($implements = NULL) {
  $implementations =& drupal_static(__FUNCTION__);
  if (isset($implements)) {
    cache_set('module_implements_node_access', $implements, 'cache_bootstrap');
  }

  // Fetch implementations from cache.
  if (empty($implementations)) {
    $implementations = cache_get('module_implements_node_access', 'cache_bootstrap');
    if ($implementations === FALSE) {
      $implementations = array();
    }
    else {
      $implementations = $implementations->data;
    }
  }
  return $implementations;
}