Currently, access to the field is done in the widget itself, which is not such a good idea imo.
A problem I experienced, I had the field in a vertical tab (fieldgroup), and for users without access to the field, the fieldgroup would appear empty (while it should be hidden.
Checking the html, I saw an empty html container for the radioactivity field.
This can be fixed by adding the following implementation of hook_field_access:
/**
* Implements hook_field_access().
*/
function radioactivity_field_access($op, $field, $entity_type, $entity, $account) {
if ($field['type'] == 'radioactivity' && $op == 'edit') {
return user_access("edit radioactivity");
}
return TRUE;
}
Comments
Comment #0.0
rv0 commentedtypo
Comment #1
rv0 commentedGot burned by this again. Adding a patch.
This also corrects the documentation of the widget function and removes the redundant access check there.
Comment #2
rv0 commentedbump
Comment #3
rv0 commentedbump^2
Comment #5
sutharsan commentedBetter late then never ;)