function taxonomy_permissions_field_access in Taxonomy Permissions 7
Implements hook_field_access().
File
Code
function taxonomy_permissions_field_access($op, $field, $entity_type, $entity, $account) {
// Remove taxonomy_term_reference fields for disallowed vocabularies.
if ($field['type'] == 'taxonomy_term_reference') {
foreach ($field['settings']['allowed_values'] as $tree) {
if ($vocabulary = taxonomy_vocabulary_machine_name_load($tree['vocabulary'])) {
if (!user_access(taxonomy_permissions_permission_name($vocabulary), $account)) {
return FALSE;
}
}
}
}
}