You are here

function module_grants_module_implements_alter in Module Grants 7

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 50

Code

function module_grants_module_implements_alter(&$implementations, $hook) {
  if ($hook == 'node_access') {
    $mg_name = 'module_grants';
    $mg_group = $implementations[$mg_name];
    unset($implementations[$mg_name]);
    module_grants_set_node_access_implementations($implementations);
    foreach ($implementations as $module => $group) {
      unset($implementations[$module]);
    }
    $implementations[$mg_name] = $mg_group;
  }
  else {
    if ($hook == 'query_node_access_alter') {
      unset($implementations['node']);
    }
    else {
      if ($hook == 'query_entity_field_access_alter') {
        unset($implementations['node']);
      }
    }
  }
}