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.

Issue fork vbo_export-3261736

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

n_e_ created an issue. See original summary.

n_e_’s picture

StatusFileSize
new613 bytes

Curious to see results of testing.

mohammad-fayoumi’s picture

I would like to bring to your attention that this issue appears to be critical within the module.
I was wondering if there have been any recent developments or updates regarding this matter?

mohammad-fayoumi’s picture

Version: 8.x-3.x-dev » 4.x-dev
StatusFileSize
new613 bytes

Rewrite the patch with 4.x-dev

skymen’s picture

Status: Active » Needs review
StatusFileSize
new3.37 KB

Unfortunately patch 4 not worked for me. So I investigated the problem deeply and made the new patch.
The main cause of the problem - "views->result" always contains rows with all possible translations. I was looked to "views_bulk_operations" module solution and write the similar one.

Please, test and review.

skymen’s picture

StatusFileSize
new4.87 KB

New version of the patch. Fixed multilingual pdf export.

skymen’s picture

StatusFileSize
new4.36 KB

Updated version of the previous patch.

skymen’s picture

StatusFileSize
new5.86 KB

Updated.

astonvictor made their first commit to this issue’s fork.

astonvictor’s picture

Status: Needs review » Reviewed & tested by the community

Hi there,

I prepared a new MR with the fixes for merge conflicts.
thanks in advance.

astonvictor’s picture

Version: 4.x-dev » 4.2.x-dev
Status: Reviewed & tested by the community » Fixed

fixed in a new 4.2.x branch
thanks

Status: Fixed » Closed (fixed)

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