PayPalCheckout.php in Commerce PayPal 8        
                          
                  
                        
  
  
  
  
File
  src/Plugin/Commerce/CheckoutFlow/PayPalCheckout.php
  
    View source  
  <?php
namespace Drupal\commerce_paypal\Plugin\Commerce\CheckoutFlow;
use Drupal\commerce_checkout\Plugin\Commerce\CheckoutFlow\CheckoutFlowWithPanesBase;
use Drupal\Core\Form\FormStateInterface;
class PayPalCheckout extends CheckoutFlowWithPanesBase {
  
  public function getSteps() {
    
    return [
      'order_information' => [
        'label' => $this
          ->t('Order information'),
        'has_sidebar' => TRUE,
        'previous_label' => $this
          ->t('Go back'),
      ],
      'review' => [
        'label' => $this
          ->t('Review'),
        'next_label' => $this
          ->t('Continue to review'),
        'previous_label' => $this
          ->t('Go back'),
        'has_sidebar' => TRUE,
      ],
    ] + parent::getSteps();
  }
  
  public function getPanes() {
    $panes = parent::getPanes();
    
    $black_list = [
      'contact_information',
      'payment_information',
      'payment_process',
    ];
    return array_diff_key($panes, array_combine($black_list, $black_list));
  }
  
  public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
    parent::validateConfigurationForm($form, $form_state);
    $values = $form_state
      ->getValue($form['#parents']);
    $pane_values = $values['panes'];
    if (!isset($pane_values['paypal_checkout_payment_process']) || $pane_values['paypal_checkout_payment_process']['step_id'] !== 'payment') {
      $pane = $this
        ->getPane('paypal_checkout_payment_process');
      $form_state
        ->setError($form['panes'], $this
        ->t('The %title pane must be configured in the payment region.', [
        '%title' => $pane
          ->getLabel(),
      ]));
    }
  }
}
 
Classes
        
  
  
      
      
         
      
                  | Name   | Description | 
    
    
          
                  | PayPalCheckout | Provides a custom checkout flow for use by PayPal Checkout. |