fix: offline bypass redirect loop, add default bypassed pages
- Move from onAfterRoute to onAfterInitialise (earlier in lifecycle) - Remove forced tmpl=component which broke rendering - Default bypassed pages: terms-of-service, privacy-policy, community-guidelines, support, tickets, submit-a-ticket Authored-by: Moko Consulting Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -30,11 +30,11 @@ final class Tos extends CMSPlugin implements SubscriberInterface
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
return [
|
||||
'onAfterRoute' => 'onAfterRoute',
|
||||
'onAfterInitialise' => 'onAfterInitialise',
|
||||
];
|
||||
}
|
||||
|
||||
public function onAfterRoute(): void
|
||||
public function onAfterInitialise(): void
|
||||
{
|
||||
$app = $this->getApplication();
|
||||
|
||||
@@ -61,9 +61,17 @@ final class Tos extends CMSPlugin implements SubscriberInterface
|
||||
$slugs = (array) $slugs;
|
||||
}
|
||||
|
||||
// Default bypassed pages when none configured
|
||||
if (empty($slugs))
|
||||
{
|
||||
return;
|
||||
$slugs = [
|
||||
'legal/terms-of-service',
|
||||
'legal/privacy-policy',
|
||||
'legal/community-guidelines',
|
||||
'support',
|
||||
'support/tickets',
|
||||
'support/submit-a-ticket',
|
||||
];
|
||||
}
|
||||
|
||||
$includeChildren = (int) $this->params->get('include_children', 1);
|
||||
@@ -167,6 +175,5 @@ final class Tos extends CMSPlugin implements SubscriberInterface
|
||||
private function bypassOffline($config, $app): void
|
||||
{
|
||||
$config->set('offline', 0);
|
||||
$app->getInput()->set('tmpl', 'component');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user