fotorama-gallery-field.html.twig in Fotorama Gallery 8.2
Same filename and directory in other branches
Default theme implementation for a fotorama gallery field.
To override output, copy the "fotorama-gallery-field.html.twig" from the templates directory to your theme's directory and customize it, just like customizing other Drupal templates such as page.html.twig or node.html.twig.
Instead of overriding the theming for all fields, you can also just override theming for a subset of fields using Theme hook suggestions. For example, here are some theme hook suggestions that can be used for a field_foo with format fotorama gallery on an article node type:
- fotorama-gallery-field--node--field-foo--article.html.twig
- fotorama-gallery-field--node--field-foo.html.twig
- fotorama-gallery-field--node--article.html.twig
- fotorama-gallery-field--field-foo.html.twig
- fotorama-gallery-field--text-with-summary.html.twig
- fotorama-gallery-field.html.twig
Available variables:
- attributes: HTML attributes for the containing element.
- label_hidden: Whether to show the field label or not.
- title_attributes: HTML attributes for the title.
- label: The label for the field.
- multiple: TRUE if a field can contain multiple items.
- items: List of all the field items. Each item contains:
- attributes: List of HTML attributes for each item.
- content: The field item's content.
See also
File
templates/fotorama-gallery-field.html.twigView source
- {#
- /**
- * @file
- * Default theme implementation for a fotorama gallery field.
- *
- * To override output, copy the "fotorama-gallery-field.html.twig" from the templates directory
- * to your theme's directory and customize it, just like customizing other
- * Drupal templates such as page.html.twig or node.html.twig.
- *
- * Instead of overriding the theming for all fields, you can also just override
- * theming for a subset of fields using
- * @link themeable Theme hook suggestions. @endlink For example,
- * here are some theme hook suggestions that can be used for a field_foo with format fotorama gallery
- * on an article node type:
- * - fotorama-gallery-field--node--field-foo--article.html.twig
- * - fotorama-gallery-field--node--field-foo.html.twig
- * - fotorama-gallery-field--node--article.html.twig
- * - fotorama-gallery-field--field-foo.html.twig
- * - fotorama-gallery-field--text-with-summary.html.twig
- * - fotorama-gallery-field.html.twig
- *
- * Available variables:
- * - attributes: HTML attributes for the containing element.
- * - label_hidden: Whether to show the field label or not.
- * - title_attributes: HTML attributes for the title.
- * - label: The label for the field.
- * - multiple: TRUE if a field can contain multiple items.
- * - items: List of all the field items. Each item contains:
- * - attributes: List of HTML attributes for each item.
- * - content: The field item's content.
- *
- * @see template_preprocess_fotorama_gallery_field()
- *
- * @ingroup themeable
- */
- #}
- {{ attach_library('fotorama_gallery/fotorama') }}
- {% if label_hidden %}
- {% if multiple %}
- <div{{ attributes.addClass('fotorama') }}>
- {% for item in items %}
- {{ item.content }}
- {% endfor %}
- </div>
- {% else %}
- {% for item in items %}
- {{ item.content }}
- {% endfor %}
- {% endif %}
- {% else %}
- <div>
- <div{{ title_attributes }}>{{ label }}</div>
- {% if multiple %}
- <div {{ attributes.addClass('fotorama') }}>
- {% endif %}
- {% for item in items %}
- {{ item.content }}
- {% endfor %}
- {% if multiple %}
- </div>
- {% endif %}
- </div>
- {% endif %}