<?php


/**
 * @file
 * Test module for Organic groups.
 */

/**
 * Implements hook_node_access().
 */
function og_test_node_access($node, $op, $account) {
  $return = NODE_ACCESS_IGNORE;

  if ($op == 'update' && $node->title == 'deny access') {
    $return = NODE_ACCESS_DENY;
  }
  return $return;
}

/**
 * Implements hook_field_access().
 */
function og_test_field_access($op, $field, $entity_type, $entity, $account) {
  if (!variable_get('og_test_hide_audience', FALSE)) {
    return;
  }

  if ($field['field_name'] != OG_AUDIENCE_FIELD) {
    return;
  }

  if ($op != 'edit') {
    return;
  }

  return FALSE;
}