You are here

webform-codemirror.html.twig in Webform 8.5

Same filename and directory in other branches
  1. 6.x templates/webform-codemirror.html.twig

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\webform\Element\WebformCodeMirror()

template_preprocess_webform_codemirror()

File

templates/webform-codemirror.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Theme implementation for 'CodeMirror' code.
  5. *
  6. * Available variables
  7. * - code: The code.
  8. * - type: The type of code.
  9. * - mode: The CodeMirror mode used to format the code.
  10. *
  11. * @see http://codemirror.net/doc/manual.html#option_mode
  12. * @see \Drupal\webform\Element\WebformCodeMirror()
  13. * @see template_preprocess_webform_codemirror()
  14. *
  15. * @ingroup themeable
  16. */
  17. #}
  18. {% if type == 'html' %}
  19. {{ attach_library('webform/webform.element.codemirror.html') }}
  20. {% elseif type == 'yaml' %}
  21. {{ attach_library('webform/webform.element.codemirror.yaml') }}
  22. {% else %}
  23. {{ attach_library('webform/webform.element.codemirror.text') }}
  24. {% endif %}
  25. <pre class="js-webform-codemirror-runmode webform-codemirror-runmode" data-webform-codemirror-mode="{{ mode }}">{{ code }}</pre>