You are here

function uc_tax_form_uc_order_edit_form_alter in Ubercart 8.4

Implements hook_form_uc_order_edit_form_alter().

File

uc_tax/uc_tax.module, line 35
Ubercart Tax module.

Code

function uc_tax_form_uc_order_edit_form_alter(&$form, FormStateInterface $form_state) {
  $order = $form['#order'];
  $line_items = $order->line_items;
  foreach ($line_items as $item) {

    // Tax line items are stored in the database, but they can't be changed by
    // the user.
    if ($item['type'] == 'tax') {
      $form['line_items'][$item['line_item_id']]['title'] = [
        '#markup' => $item['title'],
      ];
      $form['line_items'][$item['line_item_id']]['amount'] = [
        '#theme' => 'uc_price',
        '#price' => $item['amount'],
      ];
    }
  }
}