function commerce_line_item_field_access in Commerce Core 7
Implements hook_field_access().
File
- modules/
line_item/ commerce_line_item.module, line 188 - Defines the core Commerce line item entity and API functions interact with line items on orders.
Code
function commerce_line_item_field_access($op, $field, $entity_type, $entity, $account) {
// Block field edit access to line item fields that are computed only.
if ($op == 'edit' && $entity_type == 'commerce_line_item') {
// Build an array of computed field names.
$computed_fields = array(
'commerce_total',
);
if (in_array($field['field_name'], $computed_fields)) {
return FALSE;
}
}
}