Allow to alter exported rows at the end of render

Created on 4 September 2023, about 1 year ago
Updated 25 September 2023, about 1 year ago

Problem/Motivation

Currently, there is no way to alter the exported rows within one operation, just the way to alter a single row by this call:

\Drupal::moduleHandler()->alter('views_data_export_row', $output, $row, $this->view);

But, in some cases, it's helpful to receive all the rows as arguments and alter them by some conditions. For example, case of my project:

I need to append some external data from API for each exported row (so kind of an extra column). But I need to perform 1*N (number of rows) API requests within the existing implementation and that is not so good in terms of performance/API limitations.

Proposed resolution

Add another alter hook that will be called right after the loop over the view rows is finished (similar to what other modules do), here - views_data_export/src/Plugin/views/style/DataExport.php:244.

User interface changes

No

API changes

A new alter hook.

✨ Feature request
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡¦Ukraine quadrexdev Lutsk

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

Comments & Activities

Production build 0.71.5 2024