event > resources : enable external and internal link. #8

This commit is contained in:
isUnknown 2024-10-31 15:59:51 +01:00
parent d250164915
commit 68bb8a75f9
2 changed files with 15 additions and 4 deletions

View file

@ -178,9 +178,14 @@ tabs:
label: Nom
type: text
width: 1/2
file:
label: Fichier
type: files
link:
label: Lien
type: link
options:
- url
- page
- file
help: Pour lier un fichier, il faut d'abord l'ajouter dans l'onglet "Fichiers" de cette page.
multiple: false
width: 1/2
linkedPages:

View file

@ -149,7 +149,13 @@
<div class="collapsable__item--padding grid">
<?php foreach($page->resources()->toStructure() as $resource): ?>
<div class="resource grid__item" style="--span: 4;">
<p><?= $resource->name() ?></p><a href="<?= $resource->file()->toFile()->url() ?>" title="Télécharger le fichier" download>télécharger ↓</a>
<?php if ($resource->link()->isNotEmpty()): ?>
<?php if ($resource->link()->toFile()): ?>
<p><?= $resource->name() ?></p><a href="<?= $resource->link()->toUrl() ?>" title="Télécharger le fichier" download>télécharger ↓</a>
<?php else: ?>
<?php snippet('a', ['url' => $resource->link()->toUrl(), 'text' => $resource->name() . ' →']) ?>
<?php endif ?>
<?php endif ?>
</div>
<?php endforeach ?>
</div>