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.twigView source
- {#
- /**
- * @file
- * 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.
- */
- #}
- {%
- set attach = {
- id: id,
- content: [
- 'description',
- 'filename',
- ],
- }
- %}
- <audio controls src="{{ url }}" type="{{ mime_type }}"{{ attributes }} contenteditable="false" data-insert-attach='{{ attach|json_encode() }}'></audio>