Would be helpful if workbench_access_get_assigned_fields could be used with other entity types. Right now, 'node' is hardcoded as the entity type for the field_info_instances() function calls.

Comments

matt.mendonca’s picture

This patch adds two functions, workbench_access_get_assigned_entity_fields and workbench_access_get_available_entity_fields. The new functions behave the same as workbench_access_get_assigned_fields and workbench_access_get_available_fields, except that the entity_type is passed in as an argument:

function workbench_access_get_assigned_entity_fields($entity_type, $bundle, $all = FALSE) {
//...
}

function workbench_access_get_available_entity_fields($entity_type, $bundle) {
//...
}
$fields = workbench_access_get_assigned_entity_fields('node', 'article');
$available = workbench_access_get_available_entity_fields('node', 'article');

$fields = workbench_access_get_assigned_entity_fields('file', 'document');
$available = workbench_access_get_available_entity_fields('file', 'document');

//etc.
matt.mendonca’s picture

Corrected workbench_access_get_available_entity_fields workbench_access_get_assigned_fields instead of workbench_access_get_assigned_entity_fields.