function _uc_tax_to_line_item in Ubercart 8.4
Converts a tax object to the format expected by line item callbacks.
Parameters
$tax: A tax object as returned by hook_uc_tax_calculate().
Return value
array A line item array suitable for returning from line item callbacks.
2 calls to _uc_tax_to_line_item()
- TaxDisplay::display in uc_tax/
src/ Plugin/ Ubercart/ LineItem/ TaxDisplay.php - uc_tax_uc_order_update in uc_tax/
uc_tax.module - Implements hook_uc_order_update().
File
- uc_tax/
uc_tax.module, line 185 - Ubercart Tax module.
Code
function _uc_tax_to_line_item($tax) {
$line = [
'id' => $tax->summed ? 'tax' : 'tax_included',
'title' => !empty($tax->name) ? $tax->name : $tax->id,
'amount' => $tax->amount,
'weight' => \Drupal::config('uc_tax.settings')
->get('tax_line_item.weight') + (!empty($tax->weight) ? $tax->weight / 10 : 0),
'data' => isset($tax->data) ? $tax->data : [],
];
$line['data']['tax_id'] = $tax->id;
return $line;
}