You are here

function basic_cart_form_alter in Basic cart 8.4

Same name and namespace in other branches
  1. 8.6 basic_cart.module \basic_cart_form_alter()
  2. 8 basic_cart.module \basic_cart_form_alter()
  3. 8.0 basic_cart.module \basic_cart_form_alter()
  4. 8.2 basic_cart.module \basic_cart_form_alter()
  5. 8.3 basic_cart.module \basic_cart_form_alter()
  6. 8.5 basic_cart.module \basic_cart_form_alter()
  7. 7.3 basic_cart.module \basic_cart_form_alter()

Implements hook_form_alter().

File

./basic_cart.module, line 85
Basic cart module file.

Code

function basic_cart_form_alter(&$form, FormStateInterface $form_state, $form_id) {
  $form_ids = array(
    'node_basic_cart_order_edit_form',
    'node_basic_cart_order_form',
  );
  if (in_array($form_id, $form_ids)) {
    $form['title']['widget'][0]['value']['#title'] = t('Name');
    unset($form['basic_cart_vat']);
    unset($form['basic_cart_total_price']);
    unset($form['basic_cart_content']);
    $form['actions']['submit']['#value'] = t('Place Order');
    foreach (array_keys($form['actions']) as $action) {
      if ($action != 'preview' && isset($form['actions'][$action]['#type']) && $form['actions'][$action]['#type'] === 'submit') {
        $form['actions'][$action]['#submit'][] = 'basic_cart_order_submit';
      }
    }
  }
}