You are here

insert-video.html.twig in Insert 8.2

{#
/**
 * @file
 * Template file for video 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',
    ],
  }
%}
<video controls src="{{ url }}" type="{{ mime_type }}"{{ attributes }} contenteditable="false" data-insert-attach='{{ attach|json_encode() }}'></video>

File

templates/insert-video.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Template file for video 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. set attach = {
  28. id: id,
  29. content: [
  30. 'description',
  31. 'filename',
  32. ],
  33. }
  34. %}
  35. <video controls src="{{ url }}" type="{{ mime_type }}"{{ attributes }} contenteditable="false" data-insert-attach='{{ attach|json_encode() }}'></video>