feat: maintenance mode indicator for whitelisted ips
This commit is contained in:
@@ -31,6 +31,7 @@ class AppExtension extends AbstractExtension
|
||||
return [
|
||||
new TwigFunction('icon', [AppRuntime::class, 'renderIcon'], ['needs_environment' => true, 'is_safe' => ['html']]),
|
||||
new TwigFunction('is_current_route', [AppRuntime::class, 'isCurrentRoute']),
|
||||
new TwigFunction('is_maintenance_mode', [AppRuntime::class, 'isMaintenanceMode']),
|
||||
new TwigFunction('return_url', [AppRuntime::class, 'getEncodedReturnUrl']),
|
||||
new TwigFunction('forwarded_return_url', [AppRuntime::class, 'getForwardedReturnUrl']),
|
||||
new TwigFunction('qa_attribute', [AppRuntime::class, 'renderQaAttribute'], ['is_safe' => ['html']]),
|
||||
|
||||
@@ -180,6 +180,14 @@ class AppRuntime implements RuntimeExtensionInterface
|
||||
return $requestedRoute === $route;
|
||||
}
|
||||
|
||||
/**
|
||||
* The attribute is set by MaintenanceModeListener, on the ip whitelist branch only.
|
||||
*/
|
||||
public function isMaintenanceMode(): bool
|
||||
{
|
||||
return true === $this->requestStack->getMainRequest()?->attributes->get('_maintenance_mode_allowed');
|
||||
}
|
||||
|
||||
public function getEncodedReturnUrl(): string
|
||||
{
|
||||
$masterRequest = $this->requestStack->getMainRequest();
|
||||
|
||||
Reference in New Issue
Block a user