public static function WebformCodeMirror::preRenderWebformCodeMirror in Webform 8.5
Same name and namespace in other branches
- 6.x src/Element/WebformCodeMirror.php \Drupal\webform\Element\WebformCodeMirror::preRenderWebformCodeMirror()
Prepares a #type 'webform_code' render element for theme_element().
Parameters
array $element: An associative array containing the properties of the element. Properties used: #title, #value, #description, #size, #maxlength, #placeholder, #required, #attributes.
Return value
array The $element with prepared variables ready for theme_element().
File
- src/
Element/ WebformCodeMirror.php, line 131
Class
- WebformCodeMirror
- Provides a webform element for using CodeMirror.
Namespace
Drupal\webform\ElementCode
public static function preRenderWebformCodeMirror(array $element) {
static::setAttributes($element, [
'js-webform-codemirror',
'webform-codemirror',
$element['#mode'],
]);
$element['#attributes']['data-webform-codemirror-mode'] = static::getMode($element['#mode']);
$element['#attached']['library'][] = 'webform/webform.element.codemirror.' . $element['#mode'];
return $element;
}