Your cart is empty!
Build Row
public function onBuildRowCSV(array &$row, object $data, mixed $handler) : void
Fires while constructing a row of the CSV table.
Description
Trigger hook to allow the plugins to manipulate the row that is going to be added into the CSV body. Here it is possible to attach new columns, detach existing columns and reorder them.
This hook iterates up to the number of rows fetched from the database.
Notice that the same changes must be applied to the head of the CSV, otherwise the columns might result shifted.
Parameters
- &$row
-
(array) An associative array containing the data of the row to export.
- $data
-
(object) The object holding a row fetched from the database.
- $handler
-
(VAPOrderExportDriverCsv) The instance used to export the records.
Return Value
None.
Example
/**
* Trigger event to allow the plugins to manipulate the row that
* is going to be added into the CSV body. Here it is possible to
* attach new columns, detach existing columns and reorder them.
* Notice that the same changes must be applied to the head of the
* CSV, otherwise the columns might result shifted.
*
* @param mixed &$row The CSV body row.
* @param object $data The row fetched from the database.
* @param mixed $handler The current handler instance.
*
* @return void
*/
public function onBuildRowCSV(&$row, $data, $handler)
{
// include the user ID as a new column
$row['id_user'] = $data->id_user;
// get rid of order key column
unset($row['sid']);
}
Changelog
Version | Description |
---|---|
1.7 | Introduced. |
Last Update: 2021-10-08 10:04
Helpful?