Comments

bforchhammer’s picture

Hm, isn't this already covered by the "edit translation shared fields" permission?

plach’s picture

Not exactly, I might be allowed to edit shared values but find more usable to have them only when editing the original values.

bforchhammer’s picture

Status: Active » Needs review
StatusFileSize
new3.96 KB

Attached patch adds an option to the ET settings page for hiding shared fields on translation forms.

plach’s picture

Thanks!

+++ b/entity_translation.admin.inc
@@ -21,10 +21,17 @@ function entity_translation_admin_form($form, $form_state) {
+  $form['entity_translation_shared_fields_original_only'] = array(

Can we make this a per-bundle setting? I'd like to do the same also for the options above, but that's another issue.

+++ b/entity_translation.module
@@ -1129,12 +1129,11 @@ function entity_translation_field_attach_form($entity_type, $entity, &$form, &$f
-      $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]['#access'] = !empty($form[$field_name]['#access']) && ($field['translatable'] || $handler->getSharedFieldsAccess()) ;

Let's keep the $access variable and initialize it through the new method outside the loop to save some invocation. Also: there's a space before the trailing semicolon.

plach’s picture

Status: Needs review » Needs work
bforchhammer’s picture

Made is a per-bundle setting and fixed the $access issue.

plach’s picture

Overall the patch looked good. I tested it with users and I found a couple of issues. The attached patch fixes them.

plach’s picture

+++ b/entity_translation.module
@@ -118,6 +118,9 @@ function entity_translation_entity_info() {
+          'shared_fields_original_only' => TRUE,

On the next reroll, if we want to keep this, we should also hide shared labels by default.

plach’s picture

For consistency I reverted the user entity info default added in #7. This patch ensures that all the translatabilty clues are added only after creating an entity, which allows us to determine whether it is actually translated or not. It fixes also a notice.

plach’s picture

Committed #9 to fix those annoying bugs. Feel free to mark fixed if no follow-up is needed.

plach’s picture

Issue tags: +Needs tests

We will test coverage also for this.

plach’s picture

Status: Needs review » Fixed

I'll call this fixed. Feel free to reopen if needed.

bforchhammer’s picture

Just tested it and it seems fine. Thanks!

Automatically closed -- issue fixed for 2 weeks with no activity.

  • Commit 282b204 on 7.x-1.x, et-permissions-1829630, factory, et-fc, revisions authored by bforchhammer, committed by plach:
    Issue #1770748 by bforchhammer, plach: Option to display shared fields...

  • Commit 282b204 on 7.x-1.x, et-permissions-1829630, factory, et-fc, revisions, workbench authored by bforchhammer, committed by plach:
    Issue #1770748 by bforchhammer, plach: Option to display shared fields...