Hello Kirby community,
i’ve got following (part) of snippet:
<?php
$transitcodes = $data->transitcode()->split();
$items = page('datenbank')->children()->filterBy('template', 'document')->filter(function($item) use($transitcodes) {
return in_array($item->documentidentifiercode(), $transitcodes);
});
foreach($items as $item): ?>
<a href="<?php if($file = $item->documentselect()->toFile()) {echo $file->url();} ?>"><button class="btn is-download"><i class="fas fa-arrow-down"></i></button></a>
<?= $item->title()->html() ?>
<?php endforeach ?>
the line with link (<a href… ) has documentselect()->toFile - this way it calls the file that has been selected in panel. Mostly these are word, pdf or excel files.
I’d like to add a part of snippet that recognizes file extension in order to display file icon (that i can implement via fontawesome). Is that possible?