O'Reilly logo

Drupal 8 Module Development by Daniel Sipos

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Global overrides

In Drupal 8, we still have the global override possibility via a global variable, this time called $config. This variable is available in the settings.php file for site-wide overrides, but you can also use it inside your module (if you really have to!) in order to override a specific piece of configuration:

global $config;$config['system.maintenance']['message'] = 'Our own message for the site maintenance mode';

In this example we changed, on the fly, the message used for the site maintenance mode. Why one would want to do that is beside the point, but you may have some other configuration which would benefit from being overridable like this. In any case, you notice the array notation we use. The first key is the name of ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required