English (United Kingdom)

apply_filters_ref_array( 'vikappointments_build_row_csv', bool $status, array &$row, object $data, mixed $handler )

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

$status

(bool)  True on success, false on failure.

&$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.


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  boolean  $status   True on success, false on failure.
 * @param  mixed    &$row     The CSV body row.
 * @param  object   $data     The row fetched from the database.
 * @param  mixed    $handler  The current handler instance.
 */
add_filter('vikappointments_build_row_csv', function($status, &$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']);

    return $status;
}, 10, 4);

Changelog

Version Description
1.2 Introduced.
Last Update: 2021-08-06
Helpful?

This website uses cookies

This website uses cookies and similar technologies. Some of these technologies are necessary for the proper functioning of the website (Essential). Other technologies are used to evaluate user behavior (Analysis), to integrate external media or for advertising purposes. If you agree, these technologies are activated. For details, please refer to the privacy policy. From this same page you can also update/revoke your consent. If you do not give your consent, only cookies with essential functions will be activated.

We use technologies from the USA on our website. If you give your consent, you therefore consent at the same time to your data being transferred to the USA. We would like to point out that the USA does not have a level of data protection comparable to that of the EU and that any US company can be obliged by state authorities to hand over your data without you having any effective legal protection against this.