The findCalendarBoundaries
hook allows you to modify the boundary that the calendar module allows you to display. The calendar module
always displays a certain month and generates links to the previous and next month, if there are events in that month. However, if you are
dynamically adding events via the getAllEvents
you might want to override this boundary manually via this hook, so
that the calendar module still displays pagination links to the desired months.
int $dateFrom
UNIX timestamp of the lower boundary.
int $dateTo
UNIX timestamp of the upper boundary.
int $repeatUntil
The maximum repeatEnd
value in tl_calendar_events
for the selected archives.
\Contao\Module $module
The front end module instance executing this hook.
// src/EventListener/FindCalendarBoundariesListener.php
namespace App\EventListener;
use Contao\CoreBundle\DependencyInjection\Attribute\AsHook;
use Contao\Module;
#[AsHook('findCalendarBoundaries')]
class FindCalendarBoundariesListener
{
public function __invoke(int &$dateFrom, int &$dateTo, int &$repeatUntil, Module $module): array
{
// Modify $dateForm, $dateTo or $repeatUntil here
}
}