You are here

function pbf_create_grant in Permissions by field 8

Helper function to generate a grant array.

Parameters

array $value: The field values.

string $field_name: The field name used for the realm.

int $priority: The permissions's priority.

Return value

array $grant The grant array.

1 call to pbf_create_grant()
pbf_node_access_records in ./pbf.module
Implements hook_node_access_records().

File

./pbf.module, line 215
Contains pbf.module.

Code

function pbf_create_grant($value, $field_name, $priority = 0) {

  // @todo support langcode
  $grant = array(
    'realm' => 'pbf_' . $field_name,
    'gid' => $value['target_id'],
    'grant_view' => $value['grant_view'],
    'grant_update' => $value['grant_update'],
    'grant_delete' => $value['grant_delete'],
    'priority' => $priority,
  );
  return $grant;
}