public static function Stripe::preRenderStripe in Stripe 8
Prepares a 'stripe' #type element for rendering.
File
- src/
Element/ Stripe.php, line 56
Class
- Stripe
- Provides a form element that will be rendered by stripe elements.
Namespace
Drupal\stripe\ElementCode
public static function preRenderStripe($element) {
Element::setAttributes($element, [
'id',
]);
$selectors = array_filter($element['#stripe_selectors']);
if (!empty($selectors)) {
$element['#attributes']['data-drupal-stripe-selectors'] = Json::encode($element['#stripe_selectors']);
}
return $element;
}