public static function YamlFormCompositeBase::preRenderCompositeFormElement in YAML Form 8
Adds form element theming to an element if its title or description is set.
This is used as a pre render function for checkboxes and radios.
Overrides CompositeFormElementTrait::preRenderCompositeFormElement
1 call to YamlFormCompositeBase::preRenderCompositeFormElement()
- YamlFormLocation::preRenderCompositeFormElement in src/
Element/ YamlFormLocation.php - Adds form element theming to an element if its title or description is set.
1 method overrides YamlFormCompositeBase::preRenderCompositeFormElement()
- YamlFormLocation::preRenderCompositeFormElement in src/
Element/ YamlFormLocation.php - Adds form element theming to an element if its title or description is set.
File
- src/
Element/ YamlFormCompositeBase.php, line 74
Class
- YamlFormCompositeBase
- Provides an base composite form element.
Namespace
Drupal\yamlform\ElementCode
public static function preRenderCompositeFormElement($element) {
$element = CompositeFormElementTrait::preRenderCompositeFormElement($element);
// Add class name to wrapper attributes.
$class_name = str_replace('_', '-', $element['#type']);
$element['#attributes']['class'][] = 'js-' . $class_name;
$element['#attributes']['class'][] = $class_name;
return $element;
}