You are here

function basic_cart_order_submit in Basic cart 8

Same name and namespace in other branches
  1. 8.6 basic_cart.module \basic_cart_order_submit()
  2. 8.0 basic_cart.module \basic_cart_order_submit()
  3. 8.2 basic_cart.module \basic_cart_order_submit()
  4. 8.3 basic_cart.module \basic_cart_order_submit()
  5. 8.4 basic_cart.module \basic_cart_order_submit()
  6. 8.5 basic_cart.module \basic_cart_order_submit()
1 string reference to 'basic_cart_order_submit'
basic_cart_form_alter in ./basic_cart.module
Implements hook_form_alter().

File

./basic_cart.module, line 344

Code

function basic_cart_order_submit(&$form, FormStateInterface $form_state, $form_id) {
  $utility = new Utility();
  $config = $utility
    ->checkoutSettings();
  $location = trim($config
    ->get('thankyou')['custom_page']);
  if ($location) {
    $redirect = \Drupal::pathValidator()
      ->getUrlIfValid($location);
    $form_state
      ->setRedirectUrl($redirect);
  }
  else {
    $url = Url::fromRoute('basic_cart.thankyou');
    $form_state
      ->setRedirectUrl($url);
  }
}