You are here

PaymentMethodAddForm.php in Commerce Core 8.2

File

modules/payment_example/src/PluginForm/Onsite/PaymentMethodAddForm.php
View source
<?php

namespace Drupal\commerce_payment_example\PluginForm\Onsite;

use Drupal\commerce_payment\PluginForm\PaymentMethodAddForm as BasePaymentMethodAddForm;
use Drupal\Core\Form\FormStateInterface;
class PaymentMethodAddForm extends BasePaymentMethodAddForm {

  /**
   * {@inheritdoc}
   */
  protected function buildCreditCardForm(array $element, FormStateInterface $form_state) {
    $element = parent::buildCreditCardForm($element, $form_state);

    // Default to a known valid test credit card number.
    $element['number']['#default_value'] = '4111111111111111';
    return $element;
  }

}

Classes