insert-icon-link.html.twig in Insert 8.2
Same filename and directory in other branches
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.twigView source
- {#
- /**
- * @file
- * 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.
- */
- #}
- {%
- set attach = {
- id: id,
- attributes: {
- title: [
- 'description',
- ],
- },
- content: [
- 'description',
- 'filename',
- ],
- }
- %}
- <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>