home > events : add custom events field (from 0 to 3 events) #7

This commit is contained in:
isUnknown 2024-10-31 16:33:38 +01:00
parent c02b9840f7
commit 6eba8122ea
2 changed files with 13 additions and 8 deletions

View file

@ -91,10 +91,22 @@ tabs:
cover: true
when:
heroMode: custom
- width: 1/1
fields:
line:
type: line
events:
label: Événement
type: pages
layout: cards
size: huge
query: page('programme').grandChildren
max: 3
image:
cover: true
otherLine:
type: line
- width: 1/1
fields:
callout: fields/callout

View file

@ -50,18 +50,11 @@
<?php snippet('calendar-strip') ?>
<?php
$orderedSeason = $kirby->collection('ordered-season');
$comingEvents = filterFutureEvents($orderedSeason);
?>
<?php
snippet('events-grid', ['title' => 'Prochainement', 'events' => $comingEvents->slice(0, 2), 'columns' => 2])
snippet('events-grid', ['title' => 'Prochainement', 'events' => $site->events()->toPages(), 'columns' => $site->events()->toPages()->count() === 1 ? 2 : $site->events()->toPages()->count()])
?>
<?php snippet('newsletter-section') ?>
<?php //snippet('events-grid', ['events' => $comingEvents->slice(2, 3)]) ?>
<?php snippet('callout') ?>
<?php snippet('footer') ?>