You are here

public static function PaymentMethodAddForm::addCountryCodeAttributes in Commerce Stripe 8

Element #pre_render callback: adds "data-stripe" to the country_code.

This ensures data-stripe is on the hidden or select element for the country code, so that it is properly passed to Stripe.

Parameters

array $element: The form element.

Return value

array The modified form element.

File

src/PluginForm/Stripe/PaymentMethodAddForm.php, line 171

Class

PaymentMethodAddForm
Provides payment form for Stripe.

Namespace

Drupal\commerce_stripe\PluginForm\Stripe

Code

public static function addCountryCodeAttributes(array $element) {
  $element['country_code']['#attributes']['data-stripe'] = 'address_country';
  return $element;
}