When I edit a node with a translated file (image) and I click on Edit Media, I expect to be able to edit the translated version of that entity, not the original.

- I've a content type Article with a Dutch translation.
- I've enable translations for the entity File and created a Dutch translation for a specific image
- While in the English interface, I've added the image to a node.
- When I switch the interface to Dutch I see the translated node and even the translated image beloning to the node
- When I EDIT the node, I have a button 'Edit media' (see screenshot). This opens a modal frame with a form to edit the image. This form however, shows the english version of the image. Not the Dutch version, as I expected.

See screenshot.

Schermafbeelding 2012-03-06 om 09.12.31.png

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

africavi’s picture

Subscribe,

I`have the same issue on file entities. I have an image file entities with some attached fields in french (I use Media with entity translation). when I add an image and translate it to english, all go well. but if I want to edit the translation, the edit form display the source entity that in french ?

plach’s picture

Status: Active » Postponed

This should be fixed once #1282018: Improve UX of language-aware entity forms is committed.

plach’s picture

Status: Postponed » Active

Does not work properly yet. Let's fix this.

plach’s picture

Title: 'Edit media' on a node/edit form points to untranslated version of the entity » Provide media integration
Category: bug » feature

We need better integration with the Media project.

plach’s picture

bforchhammer’s picture

[double post removed]

bforchhammer’s picture

Attached patch (against media-7.x-2.x) adds ET support for the media edit modal popup, with the multiple-paths patch in #1418076-18: Allow for multiple base paths... We should probably open a new issue in the media issue queue once the multiple path issue is resolved.

plach’s picture

Title: Provide media integration » Provide Entity Translation integration
Project: Entity Translation » D7 Media
Version: 7.x-1.x-dev » 7.x-2.x-dev
Component: User interface » Code
Status: Active » Needs review
FileSize
3.5 KB

The attached patch adds ET integration for the Media modal popup (requires #1418644-7: Add multilingual support for files and #1418076-22: Allow for multiple base paths).

plach’s picture

Better UX: now the link to create a translation uses the canonical local action theming. Moreover now it is possible to create a translation only in if it is missing the current content language. This way context is always kept and pressing the 'Edit media' button allows to edit the values for the current language or create a translation for the current language. Full administration of translations is still available at file/%file/translate.

plach’s picture

plach’s picture

plach’s picture

This and #1418644: Add multilingual support for files are the last blockers for the first Entity Translation beta. It would be great to have some feedback ASAP :)

bforchhammer’s picture

Status: Needs review » Needs work

Awesome, patch #11 works very well and makes translating media files soooo much easier! :)

I only have two questions/issues and think it's RTBC otherwise:

+++ b/includes/MediaEntityTranslationHandler.inc
@@ -0,0 +1,54 @@
+    if (isset($form['actions']['delete_translation'])) {
+      $form['actions']['delete_translation']['#weight'] = 10;
+    }

This is only for the "file/x/edit" pages, right? For the media path scheme it doesn't do anything because the "delete translation" action is removed anyway... So does this belong into media or should it be in file_entity?

+++ b/includes/MediaEntityTranslationHandler.inc
@@ -0,0 +1,54 @@
+        $form['media_add_translation'] = array(
+          '#weight' => -110,
+          '#markup' => '<ul class="action-links"><li>' . $link . '</li></ul>',
+        );

Can we reuse some existing theming function for this?

plach’s picture

This is only for the "file/x/edit" pages, right? For the media path scheme it doesn't do anything because the "delete translation" action is removed anyway... So does this belong into media or should it be in file_entity?

Nice catch :) This actually would belong to File Entity, but I thought it didn't make sense to introduce a FileEntityTranslationHandler just for those two lines. Do you think it's worth?

Can we reuse some existing theming function for this?

I wasn't able to find a proper theming function. See Bartik's page.tpl.php.

bforchhammer’s picture

Nice catch :) This actually would belong to File Entity, but I thought it didn't make sense to introduce a FileEntityTranslationHandler just for those two lines. Do you think it's worth

No, I guess not. Let's leave it in here for now. (Unless media module maintainers object?)

I wasn't able to find a proper theming function. See Bartik's page.tpl.php.

Hm, looks like there's no theming function for the list then, but we can use 'menu_local_action' for the link... patch updated.

plach’s picture

Status: Needs review » Reviewed & tested by the community

Works for me.

bforchhammer’s picture

Updated the patch for the change introduced in #1799770: Update id and bundle when setting a wrapped entity (removed $entity_id from handler constructor).

plach’s picture

That was the last serious API change for Entity Translation before beta1. You can commit #17 safely, if you are happy with it.

ParisLiakos’s picture

Status: Reviewed & tested by the community » Fixed

I am happy with it, thought at first that this should be in file entity module, but i see this is about media path.
thanks both

Status: Fixed » Closed (fixed)

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

mahalo13’s picture

the problem still occurs also in the latest Dev-Version.

My Image Entity has 3 Fields (Title, Alt and Caption). If I edit a Node an click on the Edit Button for the Image, it does not pass the current Form Language so that the Fields can be edited in the actual form language.

Is there any Workaround or Solution?

mahalo13’s picture

Issue summary: View changes
Status: Closed (fixed) » Active

Please see comment #21

ParisLiakos’s picture

Status: Active » Closed (fixed)

please open a new issue, this one is long dead now

tobiberlin’s picture

Status: Closed (fixed) » Active

Although this issue was already re-closed I re-re-open it as I found out that the patch provided here was not fully adopted to the current alpha-4 version.

In the media.module file in line 71 you find the following:

  if (module_exists('entity_translation')) {
    $entity_info['file']['translation']['entity_translation']['class'] = 'MediaEntityTranslationHandler';
  }

but it needs to be

  if (module_exists('entity_translation')) {
    $entity_info['file']['translation']['entity_translation']['class'] = 'MediaEntityTranslationHandler';
    $entity_info['file']['translation']['entity_translation']['path schemes']['media'] = array('edit path' => 'media/%file/edit/%ctools_js');
  }
pmusaraj’s picture

I am running into this issue as well. If I add the line in comment 24, the translation works for fields, but not for the wysiwyg.

ParisLiakos’s picture

Status: Active » Closed (fixed)
Jody Lynn’s picture

Patch version of comment 24 attached

Berdir’s picture