function _tablefield_entity_access in TableField 7.2
Same name and namespace in other branches
- 7.3 tablefield.module \_tablefield_entity_access()
Helper function: A sort-of copy of entity_access() from entity API.
@todo Remove if entity_access() ends up in core.
1 call to _tablefield_entity_access()
- tablefield_export_csv in ./
tablefield.module - Menu callback to export a table as a CSV.
File
- ./
tablefield.module, line 152 - Provides a set of fields that can be used to store tabular data with a node.
Code
function _tablefield_entity_access($op, $entity_type, $entity = NULL, $account = NULL) {
$info = entity_get_info($entity_type);
// Use entity API access callbacks if provided.
if (isset($info[$entity_type]['access callback'])) {
$access_callback = $info[$entity_type]['access callback'];
return $access_callback($op, $entity, $account, $entity_type);
}
elseif ($entity_type == 'node') {
return node_access($op, $entity, $account);
}
elseif ($entity_type == 'user') {
return user_view_access($entity);
}
elseif ($entity_type == 'taxonomy_term') {
if (user_access('administer taxonomy', $account)) {
return TRUE;
}
if (user_access('access content', $account)) {
return TRUE;
}
}
return FALSE;
}