diff --git a/entity_translation.module b/entity_translation.module index 67ee293..7ce69bf 100644 --- a/entity_translation.module +++ b/entity_translation.module @@ -1071,19 +1071,6 @@ function entity_translation_field_attach_delete($entity_type, $entity) { } /** - * Implements hook_field_access(). - */ -function entity_translation_field_access($op, $field, $entity_type, $entity, $account) { - // Prevent user not explictly allowed from editing shared fields for entity - // types and bundles having entity translation enabled. - if (!empty($field['translatable']) || $op == 'view' || !entity_translation_enabled($entity_type, TRUE)) { - return TRUE; - } - list(, , $bundle) = entity_extract_ids($entity_type, $entity); - return !entity_translation_enabled_bundle($entity_type, $bundle) || user_access('edit translation shared fields', $account) || user_access("edit $entity_type translation shared fields", $account); -} - -/** * Implementation of hook_field_attach_form(). */ function entity_translation_field_attach_form($entity_type, $entity, &$form, &$form_state, $langcode) { @@ -1142,10 +1129,12 @@ function entity_translation_field_attach_form($entity_type, $entity, &$form, &$f // Handle fields shared between translations when there is at least one // translation available or a new one is being created. if (!$handler->isNewEntity() && ($new_translation || count($translations->data) > 1)) { + $access = user_access('edit translation shared fields') || user_access("edit $entity_type translation shared fields"); list(, , $bundle) = entity_extract_ids($entity_type, $entity); foreach (field_info_instances($entity_type, $bundle) as $instance) { $field_name = $instance['field_name']; $field = field_info_field($field_name); + $form[$field_name]['#access'] = !empty($form[$field_name]['#access']) && ($field['translatable'] || $access) ; $form[$field_name]['#multilingual'] = (boolean) $field['translatable']; } }