Since image fields aren't supported by content translation this code would probably work with entity_translation but not with standard drupal core & i18n.
$item = $row->_field_data[$view->base_field]['entity']->{$img_field_name}[$lang][0];
$items[] = $item;
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | Screen Shot 2012-04-16 at 14.34.16 PM.png | 99.82 KB | muschpusch |
| #4 | multilang-1512608-4.patch | 908 bytes | muschpusch |
| #1 | 1512608-multilang.patch | 923 bytes | muschpusch |
Comments
Comment #1
muschpusch commentedThere should be a better way to determine if entity_translation is enabled for a specific node but this works.
Comment #2
muschpusch commentedand forgot to change status...
Comment #4
muschpusch commentedahm... removed dsm() and fatal error...
Comment #5
minoroffense commentedI'll have to do some more research into Entity Translation before building it into the module. Or whether it is required at all. Maybe there's a better way to render the fields in the View which would automatically include the language information if the Entity Translation module is already enabled and a language is applied to the fields.
I also wouldn't consider this a bug and more of a feature request. The module doesn't break any core functionality.
Thanks for the patch though! If we end up using Entity Translation, I'll be sure to apply the appropriate attribution to the commit.
Comment #6
muschpusch commentedNo i think it's the other way around. Drupal core doesn't support translation of image fields which is desirable when having banners with text etc. The current code tries to load a translated image. One possible solution could be depending on entity api which handles that automatically but i'm not sure.
Comment #7
minoroffense commentedHmm, well from what I can tell all fields have a language value in their storage array (by default this is set to LANGUAGE_NONE a.k.a. 'und'). Whether Drupal exposes a means to set a language for image fields is another question.
It's also a question of whether I need to do anything special in Flex Slider. There is the possibility that the Views handler isn't coded properly for language selection. I don't know I'd have to do some more research.
I'll schedule this to be included in Flex Slider v1.3 if a change is required to have this work. I'll also look into your suggested modules.
Thanks!
Comment #8
lovaymiklos commentedHi!
A have the same problem...
Any solution?
Thanks!
Comment #9
muschpusch commentedThe correct way to check would be fiel_is_translatabe I will create new patch tomorrow...
Comment #10
muschpusch commentedfield_is_translatable doesn't return the correct value. @lovaymiklos you could apply the patch from #4 or just install entity translation which should fix it. Could you report back if entity translation works?
@minorOffense: have a look at the devel output. This is a default node when added a new language. Maybe i got something wrong but as far as i know drupal core's locale module doesn't support translation of image fields...
Comment #11
gumanist commentedTry this patch:
http://drupal.org/node/1536734#comment-5883368
Sorry, that issue should be marked as duplicate, but i found this one later.
Comment #12
gumanist commentedjust status update
Comment #13
minoroffense commented@muschpusch Were you using just Locale and Content Translation? Or did you have i18n or Entity Translation enabled at the time.
Comment #14
minoroffense commentedJust to bring over a point from the other issue
Comment #15
minoroffense commentedAlright, so I've fixed the default language handling for fields. I've put in LANGUAGE_NONE when loading the image data.
Before I put in anything to support Entity Translation I need to verify that (as described in the code above) that an Entity with a language always has fields of the same language. Since that's what the if statement in the patch is essentially saying.
If someone knows the answer to that question already, feel free to share ;-) Otherwise I'll have to do some reading inside of Entity Translation.
Comment #16
minoroffense commentedSee commit http://drupalcode.org/project/flexslider.git/commit/33eb31b
Comment #17
gumanist commentedIf you will take a look on my patch (http://drupal.org/node/1536734#comment-5883368), then you will find that solution is to use language handling defined in core.
It already checks LANGUAGE_NONE and enabled languages.
http://api.drupal.org/api/drupal/modules%21field%21field.module/function...
Comment #18
muschpusch commentedI don't have the time to test it right now but this could work:
http://api.drupal.org/api/drupal/modules%21field%21field.multilingual.in...
Comment #19
gumanist commentedagain
http://api.drupal.org/api/drupal/modules%21field%21field.module/function...
which uses http://api.drupal.org/api/drupal/modules%21field%21field.multilingual.in...
it is up to you which method to use. but as i see we have the way in drupal core, that allow get a field value in accessible language and this is the correct way to get it.
but it is up to you use own code or reuse available.
Comment #20
minoroffense commentedComment #21
minoroffense commentedI'm going to leave this to Entity Translation to take care of.