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.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | 3261736-8.patch | 5.86 KB | skymen |
| #4 | 3261736-4.patch | 613 bytes | mohammad-fayoumi |
| #2 | test-remove-call-to-render-3261736-2.patch | 613 bytes | n_e_ |
| after-render-called.png | 167.08 KB | n_e_ | |
| before-render-called.png | 171.12 KB | n_e_ |
Issue fork vbo_export-3261736
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
Comment #2
n_e_ commentedCurious to see results of testing.
Comment #3
mohammad-fayoumiI 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?
Comment #4
mohammad-fayoumiRewrite the patch with 4.x-dev
Comment #5
skymen commentedUnfortunately 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.
Comment #6
skymen commentedNew version of the patch. Fixed multilingual pdf export.
Comment #7
skymen commentedUpdated version of the previous patch.
Comment #8
skymen commentedUpdated.
Comment #11
astonvictor commentedHi there,
I prepared a new MR with the fixes for merge conflicts.
thanks in advance.
Comment #13
astonvictor commentedfixed in a new 4.2.x branch
thanks