nouveau-theatre-de-besancon/site/templates/home.php
isUnknown 8725c590b4 hero : refonte du mode event et custom
Mode event : lien vers un spectacle (pages field, multiple: false), affichage titre + auteurs + ticket/dates en front.
Mode custom : heroTextLeft (blocks) à gauche, heroTextRight (writer) + heroLink à droite. Suppression heroLinkText.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 11:35:55 +02:00

79 lines
No EOL
3 KiB
PHP

<?php snippet('header') ?>
<section class="hero">
<?php if ($site->heroMode() == 'custom'): ?>
<div class="hero__image" style="--color: var(--color-season)">
<?php if ($site->heroLink()->isNotEmpty()): ?>
<a href="<?= $site->heroLink()->toUrl() ?>" title="en savoir plus"></a>
<?php endif ?>
<div class="image-wrapper">
<?php if ($site->heroImage()->toFiles()->count() > 1): ?>
<?php snippet('picture', [
'file' => $site->heroImage()->toFiles()->first(),
'class' => 'image-cover',
'size' => 60
]) ?>
<?php endif ?>
<?php snippet('picture', ['file' => $site->heroImage()->toFiles()->count() > 1 ? $site->heroImage()->toFiles()->nth(1) : $site->heroImage()->toFiles()->first(), 'lazy' => false, 'size' => 60]) ?>
</div>
</div>
<div class="hero__text">
<div class="hero__title">
<?= $site->heroTextLeft()->toBlocks() ?>
</div>
<div class="hero__book">
<?= $site->heroTextRight() ?>
</div>
</div>
<?php else: ?>
<?php $heroEvent = $site->heroEvent()->toPage(); ?>
<div class="hero__image" style="--color: var(--color-season)">
<a href="<?= $heroEvent->url() ?>" title="en savoir plus"></a>
<div class="image-wrapper">
<?php if ($heroEvent->gallery()->toFiles()->count() > 1): ?>
<?php snippet('picture', [
'file' => $heroEvent->gallery()->toFiles()->first(),
'class' => 'image-cover',
'size' => 60
]) ?>
<?php endif ?>
<?php snippet('picture', ['file' => $heroEvent->gallery()->toFiles()->count() > 1 ? $heroEvent->gallery()->toFiles()->nth(1) : $heroEvent->gallery()->toFiles()->first(), 'lazy' => false, 'size' => 60]) ?>
</div>
</div>
<div class="hero__text">
<div class="hero__title">
<h2><?= $heroEvent->title() ?></h2>
<h3><?= $heroEvent->authors() ?></h3>
</div>
<div class="hero__book">
<?php $schedule = $heroEvent->schedule(); ?>
<?php if ($schedule): ?>
<?php
if ($heroEvent->isMapadoEvent() == 'true') {
$bookingUrl = $heroEvent->url();
} elseif ($heroEvent->bookingUrl()->isNotEmpty()) {
$bookingUrl = $heroEvent->bookingUrl()->url();
} else {
$bookingUrl = null;
}
?>
<?php snippet('ticket', $bookingUrl ? ['link' => $bookingUrl] : []) ?>
<span><?= $schedule ?></span>
<?php endif ?>
</div>
</div>
<?php endif ?>
</section>
<?php snippet('calendar-strip') ?>
<?php if ($site->events()->isNotEmpty()): ?>
<?php
snippet('events-grid', ['title' => 'Prochainement', 'events' => $site->events()->toPages(), 'columns' => $site->events()->toPages()->count() === 1 ? 2 : $site->events()->toPages()->count()])
?>
<?php endif ?>
<?php snippet('newsletter-section') ?>
<?php snippet('callout') ?>
<?php snippet('footer') ?>