MaintenanceModeSubscriber
class MaintenanceModeSubscriber implements EventSubscriberInterface (View source)
Maintenance mode subscriber for controller requests.
Traits
Wrapper methods for \Drupal\Core\StringTranslation\TranslationInterface.
Properties
| protected TranslationInterface | $stringTranslation | The string translation service. |
from StringTranslationTrait |
| protected MaintenanceModeInterface | $maintenanceMode | The maintenance mode. |
|
| protected AccountInterface | $account | The current account. |
|
| protected ConfigFactoryInterface | $config | The config factory. |
|
| protected UrlGeneratorInterface | $urlGenerator | The url generator. |
|
| protected BareHtmlPageRendererInterface | $bareHtmlPageRenderer | The bare HTML page renderer. |
|
| protected MessengerInterface | $messenger | The messenger. |
|
| protected EventDispatcherInterface | $eventDispatcher | An event dispatcher instance to use for configuration events. |
Methods
Translates a string to the current language or to a given language.
Formats a string containing a count of items.
Returns the number of plurals supported by a given language.
Gets the string translation service.
Constructs a new MaintenanceModeSubscriber.
Returns the site maintenance page if the site is offline.
Returns response when site is in maintenance mode and user is not exempt.
{@inheritdoc}
Details
protected TranslatableMarkup
t(string $string, array $args = [], array $options = [])
Translates a string to the current language or to a given language.
See \Drupal\Core\StringTranslation\TranslatableMarkup::__construct() for important security information and usage guidelines.
In order for strings to be localized, make them available in one of the ways supported by the
protected
formatPlural($count, $singular, $plural, array $args = [], array $options = [])
Formats a string containing a count of items.
protected
getNumberOfPlurals($langcode = NULL)
Returns the number of plurals supported by a given language.
protected TranslationInterface
getStringTranslation()
Gets the string translation service.
$this
setStringTranslation(TranslationInterface $translation)
Sets the string translation service to use.
__construct(MaintenanceModeInterface $maintenance_mode, ConfigFactoryInterface $config_factory, TranslationInterface $translation, UrlGeneratorInterface $url_generator, AccountInterface $account, BareHtmlPageRendererInterface $bare_html_page_renderer, MessengerInterface $messenger, EventDispatcherInterface $event_dispatcher = NULL)
Constructs a new MaintenanceModeSubscriber.
onKernelRequestMaintenance(RequestEvent $event)
Returns the site maintenance page if the site is offline.
onMaintenanceModeRequest(RequestEvent $event)
Returns response when site is in maintenance mode and user is not exempt.
static
getSubscribedEvents()
{@inheritdoc}