You are here

protected function CartForm::continueShoppingUrl in Ubercart 8.4

Returns the URL redirect for the continue shopping element.

Return value

string The URL that will be used for the continue shopping element.

2 calls to CartForm::continueShoppingUrl()
CartForm::buildForm in uc_cart/src/Form/CartForm.php
Form constructor.
CartForm::continueShopping in uc_cart/src/Form/CartForm.php
Continue shopping redirect for the cart form.

File

uc_cart/src/Form/CartForm.php, line 290

Class

CartForm
Displays the contents of the customer's cart.

Namespace

Drupal\uc_cart\Form

Code

protected function continueShoppingUrl() {
  $cart_config = $this
    ->config('uc_cart.settings');
  $url = '';

  // Use the last URL if enabled and available.
  if ($cart_config
    ->get('continue_shopping_use_last_url') && $this->session
    ->has('uc_cart_last_url')) {
    $url = $this->session
      ->get('uc_cart_last_url');
  }

  // If the URL is still empty, fall back to the default.
  if (empty($url)) {
    $url = $cart_config
      ->get('continue_shopping_url');
  }
  $this->session
    ->remove('uc_cart_last_url');
  return $url;
}