Module overrides

Although you can simply use the global $config array, that is not really the place where modules should be tinkering. First of all, because it's a global variable and it's never a good idea to change global variables, it should be mostly left to the settings.php. Second of all, because there is no way of controlling priority if multiple places try to change it in the same way. Instead, we have the module override system that we can use.

Via the module overrides, we can create a service with the config.factory.override tag (remember what tagged services are?) and in this service handle our overrides. Let's use this system to override the maintenance mode message. Inside our Hello World module, we can have the following service ...

Get Drupal 8 Module Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.