You are here

insert-audio.html.twig in Insert 8.2

Template file for audio files inserted via the Insert module.

Available variables:

  • attributes: Additional attributes.
  • class: A set of classes assigned to this item (if any).
  • entity_type: The type of the entity inserted.
  • field_type: The field type the rendered template belongs to, i.e. "file" or "image".
  • id: A unique id that is used in templates and button for synchronisation.
  • insert_settings: Insert widget settings.
  • item: The complete item being inserted.
  • mime_type: The file's mime type.
  • style_name: The style or pseudo-style name the item is inserted with.
  • url: The URL to the item.
  • uuid: The file's UUID.

Available attachment keys for the data-insert-attach attribute:

  • description: The text entered in the field widget's description text box.
  • filename: The file name.

See module documentation at https://www.drupal.org/docs/8/modules/insert on how to specify the data-insert-attach attribute.

File

templates/insert-audio.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Template file for audio files inserted via the Insert module.
  5. *
  6. * Available variables:
  7. * - attributes: Additional attributes.
  8. * - class: A set of classes assigned to this item (if any).
  9. * - entity_type: The type of the entity inserted.
  10. * - field_type: The field type the rendered template belongs to, i.e. "file" or
  11. * "image".
  12. * - id: A unique id that is used in templates and button for synchronisation.
  13. * - insert_settings: Insert widget settings.
  14. * - item: The complete item being inserted.
  15. * - mime_type: The file's mime type.
  16. * - style_name: The style or pseudo-style name the item is inserted with.
  17. * - url: The URL to the item.
  18. * - uuid: The file's UUID.
  19. *
  20. * Available attachment keys for the data-insert-attach attribute:
  21. * - description: The text entered in the field widget's description text box.
  22. * - filename: The file name.
  23. * See module documentation at https://www.drupal.org/docs/8/modules/insert
  24. * on how to specify the data-insert-attach attribute.
  25. */
  26. #}
  27. {%
  28. set attach = {
  29. id: id,
  30. content: [
  31. 'description',
  32. 'filename',
  33. ],
  34. }
  35. %}
  36. <audio controls src="{{ url }}" type="{{ mime_type }}"{{ attributes }} contenteditable="false" data-insert-attach='{{ attach|json_encode() }}'></audio>