public static function WebformCard::preRenderWebformCard in Webform 8.5
Same name and namespace in other branches
- 6.x modules/webform_cards/src/Element/WebformCard.php \Drupal\webform_cards\Element\WebformCard::preRenderWebformCard()
Adds form element theming to webform card.
Parameters
array $element: An associative array containing the properties and children of the webform card.
Return value
array The modified element.
File
- modules/
webform_cards/ src/ Element/ WebformCard.php, line 45
Class
- WebformCard
- Provides a render element for a card container.
Namespace
Drupal\webform_cards\ElementCode
public static function preRenderWebformCard(array $element) {
$element['#attributes']['data-title'] = $element['#title'];
if (!empty($element['#webform_key'])) {
$element['#attributes']['data-webform-key'] = $element['#webform_key'];
}
if (!empty($element['#prev_button_label'])) {
$element['#attributes']['data-prev-button-label'] = $element['#prev_button_label'];
}
if (!empty($element['#next_button_label'])) {
$element['#attributes']['data-next-button-label'] = $element['#next_button_label'];
}
return $element;
}