« All helpers
Call this to turn a textarea into an in-browser code editor using the CodeMirror editor.
In PHP code, call it like this:
$this->run ( 'admin/util/codemirror', array ( 'field_id' => 'body' ) );
In a view template, call it like this:
{! admin/util/codemirror?field_id=my_field !}
Alternately, you can disable the auto-initialization and call it manually on an element like this:
{! admin/util/codemirror?field_id=0 !} <textarea id="edit-me"></textarea> <script> $(function () { var codemirror = CodeMirror.fromTextArea ( document.getElementById ('my_field'), { mode: 'text/html', theme: 'default', lineNumbers: true } ); }); </script>
Additional parameters:
mode
theme
lineWrapping
Call this to turn a textarea into an in-browser code editor using the CodeMirror editor.
In PHP code, call it like this:
In a view template, call it like this:
Alternately, you can disable the auto-initialization and call it manually on an element like this:
Additional parameters:
mode
- The editor mode for syntax highlighting (default = htmlmixed)theme
- The color theme to use (default = elegant)lineWrapping
- Whether to wrap lines (default = false)