I'm working on a Drupal 9 website displaying custom table data and I need to provide CSV/XLS export links for it.
For the moment, I've defined a view consuming the custom table data thanks to the Views Custom Table module and it works fine. I've installed the Views Data Export module and configured a display to export data as CSV. This display is attached to the base display.
The CSV button is show on the view, and when I'm logged in as admin, everything works fine. When I'm just an authenticated user, and I click on the button, the display attached to the CSV export is rendered and exported in CSV (so there is all the HTML in the file).
I think it is a permission issue: Export uses REST core module and this one is performing permission check on the entity (for example, user is able to access the entity). In my view, there is no entity because data comes from the View Custom Table module (through hook_data()
).
I'm not sure if there is a simple solution, or if I need to define my own endpoint (and find a solution to keep exposed filters). Moreover, the Views Data Export PHPExcel module is not available for Drupal 8 and Drupal 9.