Keep the URL suffix when linking to the booking form
The event alias is passed as route parameter instead of being appended to the page URL, so a site with a suffix such as .html gets /kurs/anmeldung/<alias>.html instead of /kurs/anmeldung.html/<alias>. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
1d2007a701
commit
84bf180789
1 file changed
+7
-9
@@ -22,13 +22,8 @@ class BookingUrlBuilder
|
||||
|
||||
public function bookingUrl(BookingEvent $event, CalendarConfig $calendar): string
|
||||
{
|
||||
$url = $this->pageUrl($calendar->bookingPage);
|
||||
|
||||
if ('' === $url) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return rtrim($url, '/').'/'.($event->alias ?: $event->id);
|
||||
// Als Routen-Parameter, damit ein URL-Suffix (z. B. .html) hinter dem Alias steht
|
||||
return $this->pageUrl($calendar->bookingPage, ['parameters' => '/'.($event->alias ?: $event->id)]);
|
||||
}
|
||||
|
||||
public function inquiryUrl(BookingEvent $event, CalendarConfig $calendar): string
|
||||
@@ -42,7 +37,10 @@ class BookingUrlBuilder
|
||||
return $url.(str_contains($url, '?') ? '&' : '?').'event='.$event->id;
|
||||
}
|
||||
|
||||
public function pageUrl(int $pageId): string
|
||||
/**
|
||||
* @param array<string, mixed> $parameters
|
||||
*/
|
||||
public function pageUrl(int $pageId, array $parameters = []): string
|
||||
{
|
||||
if ($pageId < 1) {
|
||||
return '';
|
||||
@@ -56,7 +54,7 @@ class BookingUrlBuilder
|
||||
}
|
||||
|
||||
try {
|
||||
return $this->urlGenerator->generate($page);
|
||||
return $this->urlGenerator->generate($page, $parameters);
|
||||
} catch (\Throwable) {
|
||||
return '';
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user