Closed DavidBruchmann closed 10 months ago
Hey @DavidBruchmann
Which EXT:calendarize version do you use? In the current version for TYPO3 v11 is already a handling, that the slug information is part of the index table and use collision detection. So this should not a problem anymore. Please check your DB. Could you confirm, that the tx_clanendarize_domain_model_index (not the event!!!) table has two entries with the same „slug“ value?
Related Issue: https://github.com/lochmueller/calendarize/issues/540
Regards, Tim
Thanks for the response.
Concerning the entries in tx_calendarize_domain_model_index:
Yes, slugs of same events get a count appended in the form -n
with n as integer.
Instead of this integer I'd like to have the date in form H:i, but the -
as separator is good.
Adding :
in the URL might be a bad idea, so that could be left away.
I've to add that technically it's working, just the format is not like intended.
my versions currently:
calendarize: 12.4.4
TYPO3 11.5.21
Hi @DavidBruchmann,
in your SitePackage you could add a event listener to modify the slug during generation. The event listener could look something like this:
AddEventTimeSlugListener.php
<?php
declare(strict_types=1);
namespace MyVendor\MyExtension\EventListener;
use HDNET\Calendarize\Event\SlugSuffixGenerationEvent;
final class AddEventTimeSlugListener
{
public function __invoke(SlugSuffixGenerationEvent $event): void
{
// Optional: some additional checks, e.g. based on Model or page id (pid)
// Get the start_time as seconds since day start
$startTime = $event->getRecord()['start_time'];
// Add to the existing slug (e.g. test-20201103) the current time (17-15) resulting in test-20201103-1715
$newSlug = $event->getSlug() . '-' . date('Hi', $startTime);
// Update the slug
$event->setSlug($newSlug);
}
}
Services.yaml
...
MyVendor\MyExtension\EventListener\AddEventTimeSlugListener:
tags:
- name: event.listener
identifier: 'addEventTimeSlug'
event: HDNET\Calendarize\Event\SlugSuffixGenerationEvent
Note: if the slug is still not unique, the counting suffix will be added at later stage
See Listen to an event (TYPO3) for general implementation details.
Hey @okmiim thanks for the example and documentation add-on. I think we can close the issue, right?! Regards, Tim
Sorry for not coming back yet, I didn't test it yet. Thanks for all the input!
How to map two events on the same day when the title is the same too? Imagine a cinema where a movie is shown 3 times a day.
I tried to add some more details like below, it's not working though