Exports ignore exposed translation/language filters

Created on 1 February 2022, almost 3 years ago
Updated 22 October 2023, about 1 year ago

Problem/Motivation

When exporting nodes from a View that has an exposed filter for "Translation language", the export ignores the language filter selection.

Other exposed filters are honoured by the export.

Tested on XLSX export.

Steps to reproduce

1. Enable translation for a content type.
2. Add a piece of content in the default language.
3. Add a translation for the content.
4. Create an export View for the content type.
5. Add an exposed filter for field "Translation language"
6. Filter the view by one language.
7. Select one node from the list and click export.
8. Open the XLSX file and there will be two rows, one for the selected item and one for the translation of the selected item.

Proposed resolution

The issue seems to be caused by the call to $this->view->render($this->view->current_display); on line 218 in VboExportBase.php.

At that point $this->view->results contains a list of correctly filtered items from the View. The call to render() results in translations for each item being added to the result set, ignoring the selection made in the exposed filter.

Screenshots attached documenting the difference before and after render is called.

In particular case, not calling $this->view->render() fixes the issue. The expected list of nodes is filtered by language as expected and the field output for each cell is as expected.

I appreciate that the render() call may be doing other things that I'm not aware of, so I'd be grateful for any input on the best solution.

Remaining tasks

- Possible patch. Happy to contribute if a maintainer is able to provide some guidance on the correct course of action.

Thanks.

🐛 Bug report
Status

Active

Version

3.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024