callout : enable multiple callout. Turn fields into structured field. #15

This commit is contained in:
isUnknown 2024-11-04 14:53:28 +01:00
parent 11b52796e8
commit e5e8cad6ca
2 changed files with 31 additions and 24 deletions

View file

@ -1,20 +1,25 @@
type: group
fields:
calloutHeadline:
type: headline
label: Brève
calloutText:
label: Texte
type: writer
width: 1/3
calloutTicket:
label: Bouton de réservation
type: toggle
width: 1/6
text:
false: affiché
true: masqué
calloutColor:
label: Couleur de fond
extends: fields/color
width: 1/2
callout:
label: Brève(s)
type: structure
fields:
headline:
type: headline
label: Brève
text:
label: Texte
type: writer
width: 1/2
color:
label: Couleur de fond
extends: fields/color
width: 1/2
ticket:
label: Bouton de réservation
type: toggle
width: 1/3
help: Affiche le bouton ticket lié à la billetterie.
text:
false: affiché
true: masqué

View file

@ -1,6 +1,8 @@
<section class="callout" style="--color: <?= $site->calloutColor() ?>;">
<?= $site->calloutText() ?>
<?php if ($site->calloutTicket()->exists() && $site->calloutTicket() == 'true'): ?>
<a class="ticket-link" href="<?= option('ticketingUrl') ?>" target="_blank" title="Aller à la billetterie"><?php snippet('ticket') ?> Billetterie</a>
<?php endif ?>
</section>
<?php foreach($site->callout()->toStructure() as $callout): ?>
<section class="callout" style="--color: <?= $callout->color() ?>;">
<?= $callout->text() ?>
<?php if ($callout->ticket() == 'true'): ?>
<a class="ticket-link" href="<?= option('ticketingUrl') ?>" target="_blank" title="Aller à la billetterie"><?php snippet('ticket') ?> Billetterie</a>
<?php endif ?>
</section>
<?php endforeach ?>