WC_CSV_Exporter::export_row
Export rows to an array ready for the CSV.
Method of the class: WC_CSV_Exporter{}
No Hooks.
Returns
null. Nothing (null).
Usage
// protected - for code of main (parent) or child class $result = $this->export_row( $row_data, $key, $buffer );
- $row_data(array) (required)
- Data to export.
- $key(string) (required)
- Column being exported.
- $buffer(resource) (required)
- Output buffer.
Changelog
| Since 3.1.0 | Introduced. |
WC_CSV_Exporter::export_row() WC CSV Exporter::export row code WC 10.5.0
protected function export_row( $row_data, $key, $buffer ) {
$columns = $this->get_column_names();
$export_row = array();
foreach ( $columns as $column_id => $column_name ) {
if ( ! $this->is_column_exporting( $column_id ) ) {
continue;
}
if ( isset( $row_data[ $column_id ] ) ) {
$export_row[] = $this->format_data( $row_data[ $column_id ] );
} else {
$export_row[] = '';
}
}
$this->fputcsv( $buffer, $export_row );
++ $this->exported_row_count;
}