The field language option may cause duplicate results when field language fallback is enabled. In this case it would be useuful to be able to specify one (or more) language to reduce them. Currently the delta field column is exposed for multiple fields. A possibile solution for this use case is exposing also the language column for translatable fields, which would be also consistent with the core EFQ implementation.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

plach’s picture

Status: Active » Needs review
FileSize
2.64 KB

Here is a patch defining field, filte, argument and sort handlers field language column. Actually the first three are inherited from the locale language handlers. The patch also a fixes a small bug for the locale langauge field handler.

plach’s picture

Issue summary: View changes

Updated issue summary.

plach’s picture

bojanz’s picture

I think this would make sense.

I have a question though: currently we also have the language selector on the field settings. Is it not confusing to do both?
I understand that this is for when the join actually happens (and I'd love to move to a world where it never happens :P), but the users might find the duality confusing. How do we solve that?

plach’s picture

Correct me if I'm mistaken but if I have understood the code right that setting applies only for multiple fields, right? What about moving it under the multiple fields settings?

fabsor’s picture

FileSize
2.74 KB

We might want to separate the bug fix into it's own issue. There was another problem with the handler:

+++ b/modules/locale/views_handler_field_locale_language.inc
@@ -26,6 +26,6 @@ class views_handler_field_locale_language extends views_handler_field {
     $languages = locale_language_list(empty($this->$options['native_language']) ? 'name' : 'native');

It should be $this->options not $this->$options

I will just go ahead and post an updated patch here for now, even if it's not really directly related.

plach’s picture

@bojanz:

Any feedback on #4?

marcoka’s picture

yes fabsor, i found that bug today. you know if there is an issue that fixes these wrong object access parts

dawehner’s picture

Status: Needs review » Needs work
+++ b/modules/field.views.incundefined
@@ -396,6 +396,45 @@ function field_views_field_default_views_data($field) {
+          'field' => 'language',

As the other patch is already committed we can do some nitpicking because there is a need for a rerole anyway: for 'table' and 'field' should not be needed here.

In general this looks fine.

cossimo’s picture

What is the status of this?

I have a similar (possibly the same) issue; however, from what I've seen, the duplicates result regardless of whether Language Fallback is enabled in Entity Translation. I've created a view containing an unformatted list of fields, and filtered it on published status, a particular content type, and a date field. For any given node represented in the results, the view seems to return a duplicate for each tranlatable field in the node's content type, multiplied by the number of languages the node is tranlated into.

Any help or direction on this issue would be greatly appreciated. And if this isn't the appropriate place to post this issue (or if more detail or an export of the view is needed), please let me know.

Thanks,

Chris

cossimo’s picture

I'm thinking of posting #9 as its own issue, but would like some clarification first. I have posted significant detail about this duplication problem under a similar issue posted for entity translation: http://drupal.org/node/1330332#comment-6134296. Please take some time to give me some feedback about whether I have a real issue or whether I'm configuring something incorrectly, and further, whether I should post this issue under Views or Entity Translation. (plach, I would really appreciate your input since you've been posting about similar issues both for Views and Entity Translation.)

Thanks for your help!

Chris

klonos’s picture

@christopherostrom: ...I believe you're on the right issue Chris.

steinmb’s picture

I see duplication as soon as I try to sort by a translated field. No entity translation enabled. When I look at sql created by views can I see the problem. The sql. below lists terms from taxonomy vocal called area without translated field sorting and causes no duplication of listet terms.

SELECT taxonomy_term_data.tid AS tid, 'taxonomy_term' AS field_data_name_field_taxonomy_term_entity_type
FROM taxonomy_term_data taxonomy_term_data
LEFT JOIN taxonomy_vocabulary taxonomy_vocabulary ON taxonomy_term_data.vid = taxonomy_vocabulary.vid
INNER JOIN field_data_field_uib_area_type field_data_field_uib_area_type ON taxonomy_term_data.tid = field_data_field_uib_area_type.entity_id AND (field_data_field_uib_area_type.entity_type = 'taxonomy_term' AND field_data_field_uib_area_type.deleted = '0')
WHERE (( (taxonomy_vocabulary.machine_name IN  ('area')) AND (field_data_field_uib_area_type.field_uib_area_type_tid = '4') ))

But as soon as I add sort by translated field I get:

SELECT taxonomy_term_data.tid AS tid, field_data_name_field.name_field_value AS field_data_name_field_name_field_value, 'taxonomy_term' AS field_data_name_field_taxonomy_term_entity_type
FROM taxonomy_term_data taxonomy_term_data
LEFT JOIN taxonomy_vocabulary taxonomy_vocabulary ON taxonomy_term_data.vid = taxonomy_vocabulary.vid
INNER JOIN field_data_field_uib_area_type field_data_field_uib_area_type ON taxonomy_term_data.tid = field_data_field_uib_area_type.entity_id AND (field_data_field_uib_area_type.entity_type = 'taxonomy_term' AND field_data_field_uib_area_type.deleted = '0')
LEFT JOIN field_data_name_field field_data_name_field ON taxonomy_term_data.tid = field_data_name_field.entity_id AND (field_data_name_field.entity_type = 'taxonomy_term' AND field_data_name_field.deleted = '0')
WHERE (( (taxonomy_vocabulary.machine_name IN  ('area')) AND (field_data_field_uib_area_type.field_uib_area_type_tid = '4') ))
ORDER BY field_data_name_field_name_field_value ASC

Edit: Also tried the patch in #5 but it does not address the problem.

plach’s picture

@steinmb:

Didi you add a field language filter after applying the patch and clearing views cache?

steinmb’s picture

Status: Needs work » Needs review
FileSize
1.97 KB

Good morning
Retested, what confused me was content language vs $title_short_language, correcting this and the duplication was gone! :) Some of the patch was already part of HEAD so we need to reroll.

cossimo’s picture

#14 worked for me.

wiifm’s picture

Can also confirm #14 worked for me. Would love to see this committed.

bojanz’s picture

Status: Needs review » Reviewed & tested by the community

Let's get this in.

klonos’s picture

Status: Reviewed & tested by the community » Needs review

Works here too! Thanx ;)

mErilainen’s picture

Status: Needs review » Reviewed & tested by the community

Works as described

dawehner’s picture

Version: 7.x-3.x-dev » 8.x-3.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)
Issue tags: +Novice, +VDC

Yeah it indeed looks perfect, committed to 7.x-3.x

If someone wants to rerole the patch feel free to to that, but at some point someone else will do it.

klonos’s picture

Great news! Thanx Daniel ;)

dawehner’s picture

Status: Patch (to be ported) » Needs review
FileSize
1.86 KB

Here is a patch for that.

dawehner’s picture

Status: Needs review » Fixed

Nothing spectacular so let's get this into d8.

Status: Fixed » Closed (fixed)

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

chriscalip’s picture

Does this mean that we have to add filter field language for every single field instance in the query?

Or do we put in a random field as the field language filter?

For an optiomal user experience why not just have :

Advanced->Field Language:Current user's language
working correctly?

cossimo’s picture

No, filtering on a single field's language works fine.

chriscalip’s picture

I updated my comment on #25; i am pleasantly surprised with the speed of people commenting on this issue :)

Anyways: what cossimo missed:

For an optiomal user experience why not just have :

Advanced->Field Language:Current user's language
working correctly?

chriscalip’s picture

#26 this is not true.

I am still experiencing duplication on the result set. Please don't just disregard this action; one of the previous RTBC'ers of this issue also admitted on https://drupal.org/node/1330332#comment-6514860 that he had to do extra actions to get the desired results.
Well i also did those extra actions and it did not get the desired result.

With my experiences I do not agree on the RTBC or fixed status of this issue. This is still an active issue;

chriscalip’s picture

Status: Closed (fixed) » Active

see #28

chriscalip’s picture

Version: 8.x-3.x-dev » 7.x-3.x-dev

i did not test 8.x but i encountered the active bug on 7.x branch.

chriscalip’s picture

Version: 7.x-3.x-dev » 8.x-3.x-dev
Status: Active » Fixed

My experiences with the issue queue leads me to believe that this is another issue entirely.

Hence I am closing this down and creating a new issue.
https://drupal.org/node/1832892

Status: Fixed » Closed (fixed)

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

calculus’s picture

I applied patch #22 but there are no form fields for entering filter values. Only tickbox for exposition is available.

calculus’s picture

Issue summary: View changes

Updated issue summary.

MXT’s picture

Issue summary: View changes

This #26

No, filtering on a single field's language works fine.

does not work in my case, and #25

...have to add filter field language for every single field instance in the query

is the only working solution for my case (taxonomy based views + entity translations + sorting exposed filters)