fix : schedule() retourne '' si sessions invalides, filtre les brouillons sur la home
All checks were successful
Deploy / Deploy (push) Successful in 7s

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
isUnknown 2026-05-04 15:22:39 +02:00
parent 9fc1f6f9b4
commit f7bb3e86d4
2 changed files with 8 additions and 6 deletions

View file

@ -12,7 +12,7 @@ class EventPage extends Page {
$firstSession = $sessions->first()->date(); $firstSession = $sessions->first()->date();
$lastSession = $sessions->last()->date(); $lastSession = $sessions->last()->date();
} catch (\Throwable $th) { } catch (\Throwable $th) {
throw new Exception('Can\'t define sessions for event "' . $this->title()->value() . '".', 1); return '';
} }
$startDay = intval($firstSession->toDate('d')); $startDay = intval($firstSession->toDate('d'));

View file

@ -41,8 +41,10 @@
</div> </div>
<div class="hero__text"> <div class="hero__text">
<div class="hero__title"> <div class="hero__title">
<h2><?= $heroEvent->title() ?></h2> <a href="<?= $heroEvent->url() ?>">
<h3><?= $heroEvent->authors() ?></h3> <h2><?= $heroEvent->title() ?></h2>
<h3><?= $heroEvent->authors() ?></h3>
</a>
</div> </div>
<div class="hero__book"> <div class="hero__book">
<?php $schedule = $heroEvent->schedule(); ?> <?php $schedule = $heroEvent->schedule(); ?>
@ -56,8 +58,7 @@
$bookingUrl = null; $bookingUrl = null;
} }
?> ?>
<?php snippet('ticket', $bookingUrl ? ['link' => $bookingUrl] : []) ?> <a class="ticket-link h3" href="<?= $bookingUrl ?>" title="Plateforme de réservation"<?= e(Str::contains($bookingUrl, $site->url()), '', ' target="_blank"') ?>><?php snippet('ticket') ?> Billetterie</a>
<span><?= $schedule ?></span>
<?php endif ?> <?php endif ?>
</div> </div>
</div> </div>
@ -68,7 +69,8 @@
<?php if ($site->events()->isNotEmpty()): ?> <?php if ($site->events()->isNotEmpty()): ?>
<?php <?php
snippet('events-grid', ['title' => 'Prochainement', 'events' => $site->events()->toPages(), 'columns' => $site->events()->toPages()->count() === 1 ? 2 : $site->events()->toPages()->count()]) $homeEvents = $site->events()->toPages()->published();
snippet('events-grid', ['title' => 'Prochainement', 'events' => $homeEvents, 'columns' => $homeEvents->count() === 1 ? 2 : $homeEvents->count()])
?> ?>
<?php endif ?> <?php endif ?>