public static function CodeMirror::preRenderCodeMirror in The CodeMirror Editor 8
Enables CodeMirror editor for the element.
Parameters
array $element: An associative array containing the properties and children of the element.
Return value
array The modified element.
File
- src/
Element/ CodeMirror.php, line 48
Class
- CodeMirror
- Provides a form element for input text with code highlighting.
Namespace
Drupal\codemirror_editor\ElementCode
public static function preRenderCodeMirror(array $element) {
if (isset($element['#codemirror'])) {
$element['#attributes']['data-codemirror'] = json_encode($element['#codemirror']);
$element['#attached']['library'][] = 'codemirror_editor/editor';
}
return $element;
}