You are here

insert-icon-link.html.twig in Insert 8.2

Same filename and directory in other branches
  1. 8 templates/insert-icon-link.html.twig

Template file for links featuring a file icon 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".
  • icon_classes: Classes defining the icon appearance.
  • 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.
  • name: The file name of the item being inserted.
  • style_name: The style or pseudo-style name the item is inserted with.
  • type: file format information that may be used for setting "type" attribute.
  • 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-icon-link.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Template file for links featuring a file icon 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. * - icon_classes: Classes defining the icon appearance.
  13. * - id: A unique id that is used in templates and button for synchronisation.
  14. * - insert_settings: Insert widget settings.
  15. * - item: The complete item being inserted.
  16. * - mime_type: The file's mime type.
  17. * - name: The file name of the item being inserted.
  18. * - style_name: The style or pseudo-style name the item is inserted with.
  19. * - type: file format information that may be used for setting "type" attribute.
  20. * - url: The URL to the item.
  21. * - uuid: The file's UUID.
  22. *
  23. * Available attachment keys for the data-insert-attach attribute:
  24. * - description: The text entered in the field widget's description text box.
  25. * - filename: The file name.
  26. * See module documentation at https://www.drupal.org/docs/8/modules/insert
  27. * on how to specify the data-insert-attach attribute.
  28. */
  29. #}
  30. {%
  31. set attach = {
  32. id: id,
  33. attributes: {
  34. title: [
  35. 'description',
  36. ],
  37. },
  38. content: [
  39. 'description',
  40. 'filename',
  41. ],
  42. }
  43. %}
  44. <span class="file {{ icon_classes }}{% if class %} {{ class }}{% endif %}" contenteditable="false"{{ attributes }} data-insert-type="{{ field_type }}"><a href="{{ url }}" type="{{ type }}" data-insert-attach='{{ attach|json_encode() }}'></a></span>