yamlform-codemirror.html.twig in YAML Form 8
Theme implementation for 'CodeMirror' code.
Available variables
- code: The code.
- type: The type of code.
- mode: The CodeMirror mode used to format the code.
See also
http://codemirror.net/doc/manual.html#option_mode
\Drupal\yamlform\Element\YamlFormCodeMirror()
3 theme calls to yamlform-codemirror.html.twig
- YamlFormCodeMirror::formatHtml in src/
Plugin/ YamlFormElement/ YamlFormCodeMirror.php - Format an element's value as HTML.
- YamlFormSubmissionController::index in src/
Controller/ YamlFormSubmissionController.php - Returns a form submission in a specified format type.
- YamlFormUiElementTestForm::buildForm in modules/
yamlform_ui/ src/ Form/ YamlFormUiElementTestForm.php - Form constructor.
File
templates/yamlform-codemirror.html.twigView source
- {#
- /**
- * @file
- * Theme implementation for 'CodeMirror' code.
- *
- * Available variables
- * - code: The code.
- * - type: The type of code.
- * - mode: The CodeMirror mode used to format the code.
- *
- * @see http://codemirror.net/doc/manual.html#option_mode
- * @see \Drupal\yamlform\Element\YamlFormCodeMirror()
- * @see template_preprocess_yamlform_codemirror()
- *
- * @ingroup themeable
- */
- #}
- {% if type == 'html' %}
- {{ attach_library('yamlform/yamlform.element.codemirror.html') }}
- {% elseif type == 'yaml' %}
- {{ attach_library('yamlform/yamlform.element.codemirror.yaml') }}
- {% else %}
- {{ attach_library('yamlform/yamlform.element.codemirror.text') }}
- {% endif %}
- <pre class="js-yamlform-codemirror-runmode yamlform-codemirror-runmode" data-yamlform-codemirror-mode="{{ mode }}">{{ code }}</pre>