Field permissions are a little different than record permissions because whatever is returned from the fieldname__permission() method is applied to the record permissions as a mask. The READ_ONLY() permission only defines what permissions are "permitted" for read only, but doesn't explicitly deny any permissions. For record permissions this works because an omitted permission is the same as "not permitted". However if you use this in a field permission then the results of READ_ONLY() will only be applied as a mask to the existing record permissions - and this won't un-permit anything that was permitted as part of the getPermissions() method.
So for fields, you should either:
1. Start with the NO_ACCESS permission and explicitly add the permissions that you need.
or
2. Simply disallow the 'edit' permission.
e.g.
- Code: Select all
function fieldname__permissions($record){
return array('edit'=>0);
}
-Steve