terminal42 Extension Store
File Attribute for Isotope
Package summary
- Languages
- German
- English
- Latest version
- 1.0.0.0
- Dependencies
- php: ^8.3
- contao/core-bundle: ^5.7
- isotope/isotope-core: ^3.0
- doctrine/dbal: ^4.3
- symfony/dependency-injection: ^7.4
- symfony/http-kernel: ^7.4
- symfony/translation: ^7.4
- symfony/translation-contracts: ^3.0
Add product manuals, spec sheets, images, and other media to your Isotope 3 products directly from the Contao file manager. The Files and folders attribute lets you select one or more files or folders per product, restrict the selection to a specific directory or file type, and choose how the selection appears in the backend, including image thumbnails or a list of files inside selected folders.
File Attribute replaces the built-in File tree, Downloads, and Media management product attributes from Isotope 2. When you upgrade to Isotope 3, the extension’s database migration converts existing attributes of these types to the new Files and folders attribute.
Displaying product files in Twig
Use Contao’s content_element() function to display the files and folders selected for an Isotope product. Add the snippets below where you want the output to appear in your product reader template, and replace manuals and detail_images with the internal names of your attributes. The Backend rendering setting controls the picker in Contao. Your Twig template controls what shoppers see.
List product downloads
Use Contao’s Downloads element for manuals, data sheets, or other product documents. If an editor selects a folder, Contao includes eligible files directly inside that folder. Contao’s allowed download extensions apply.
{% set manuals = product.manuals|default|deserialize %}
{% if manuals is not empty %}
{{ content_element('downloads', {
multiSRC: manuals,
sortBy: 'name_asc'
}) }}
{% endif %}
Display a product image gallery
Use Contao’s Gallery element to display selected images or images inside selected folders. This example displays three images per row and lets visitors open them in a lightbox.
{% set images = product.detail_images|default|deserialize %}
{% if images is not empty %}
{{ content_element('gallery', {
multiSRC: images,
perRow: 3,
fullsize: true
}) }}
{% endif %}
Both examples use |deserialize to turn a single selection or a saved list of selections into the array expected by multiSRC. When the attribute is empty, the template skips the element.