function template_preprocess_webform_codemirror in Webform 8.5
Same name and namespace in other branches
- 6.x includes/webform.theme.template.inc \template_preprocess_webform_codemirror()
Prepares variables for webform CodeMirror templates.
Default template: webform-codemirror.html.twig.
Parameters
array $variables: An associative array containing the following key:
- code: The code.
- type: The type of code.
File
- includes/
webform.theme.template.inc, line 406 - Preprocessors and helper functions to make theming easier.
Code
function template_preprocess_webform_codemirror(array &$variables) {
$variables['mode'] = WebformCodeMirror::getMode($variables['type']);
if (is_string($variables['code'])) {
// Encode all HTML entities include tags.
$variables['code'] = Markup::create(htmlentities($variables['code']));
}
}