You are here

public function PaymentProcess::isVisible in Commerce Core 8.2

Determines whether the pane is visible.

Return value

bool TRUE if the pane is visible, FALSE otherwise.

Overrides CheckoutPaneBase::isVisible

File

modules/payment/src/Plugin/Commerce/CheckoutPane/PaymentProcess.php, line 144

Class

PaymentProcess
Provides the payment process pane.

Namespace

Drupal\commerce_payment\Plugin\Commerce\CheckoutPane

Code

public function isVisible() {
  if ($this->order
    ->isPaid() || $this->order
    ->getTotalPrice()
    ->isZero()) {

    // No payment is needed if the order is free or has already been paid.
    return FALSE;
  }
  $payment_info_pane = $this->checkoutFlow
    ->getPane('payment_information');
  if (!$payment_info_pane
    ->isVisible() || $payment_info_pane
    ->getStepId() == '_disabled') {

    // Hide the pane if the PaymentInformation pane has been disabled.
    return FALSE;
  }
  return TRUE;
}