You are here

insert-link.html.twig in Insert 8.2

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

Template file for generic links 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.
  • name: The file name of the item being inserted.
  • 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-link.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Template file for generic links 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. * - name: The file name of the item being inserted.
  17. * - style_name: The style or pseudo-style name the item is inserted with.
  18. * - url: The URL to the item.
  19. * - uuid: The file's UUID.
  20. *
  21. * Available attachment keys for the data-insert-attach attribute:
  22. * - description: The text entered in the field widget's description text box.
  23. * - filename: The file name.
  24. * See module documentation at https://www.drupal.org/docs/8/modules/insert
  25. * on how to specify the data-insert-attach attribute.
  26. */
  27. #}
  28. {%
  29. set attach = {
  30. id: id,
  31. attributes: {
  32. title: [
  33. 'description',
  34. ],
  35. },
  36. content: [
  37. 'description',
  38. 'filename',
  39. ],
  40. }
  41. %}
  42. <a href="{{ url }}"{% if class %} class="{{ class }}"{% endif %}{{ attributes }} data-insert-type="{{ field_type }}" data-insert-attach='{{ attach|json_encode() }}'></a>