You are here

function og_field_access_field_access in Organic groups 7

Same name and namespace in other branches
  1. 7.2 og_field_access/og_field_access.module \og_field_access_field_access()

Implements hook_field_access().

File

og_field_access/og_field_access.module, line 59
Provide field access based on group.

Code

function og_field_access_field_access($op, $field, $entity_type, $entity, $account) {
  $perm = $op == 'view' ? 'view ' . $field['field_name'] . ' field' : 'update ' . $field['field_name'] . ' field';

  // Return result only if the entity is related to OG.
  $access = og_user_access_entity($perm, $entity_type, $entity, $account);
  if (!is_null($access)) {
    return $access;
  }
}