Image
Car indicator

Useful modules: Environment Indicator

Have you ever worked with a content editor who frequently makes changes to a test environment instead of the production site? The Environment Indicator module provides a simple, but effective tool against this.

environment indicator screenshot

Introduction

The Environment Indicator module helps administrative users (e.g. content editors) identify their Drupal server environment (e.g. production, test, dev) by colour-coding the administration toolbar.

Installation

Using Composer is the way of adding a module recommended by Drupal, so run the following from the command line:

composer require drupal/environment_indicator

Enable the module from the command line with the command:

drush en environment_indicator

Configuration

Once the module has been enabled, the name and colours for each environment need to be defined. My recommended and preferred method is to make configuration changes in the settings.local.php file for each environment. If you are unfamiliar with this file then read the Drupal API documentation for example.settings.local.php. These are the entries I have used for my dev site (see screenshot above):

$config['environment_indicator.indicator']['bg_color'] = '#5B742C';
$config['environment_indicator.indicator']['fg_color'] = '#FFFFFF';
$config['environment_indicator.indicator']['name'] = 'Dev';

There are also some minor settings that can be set in the user interface (UI):

environment indicator settings screenshot

These settings can be found at /admin/config/development/environment-indicator or through the menu system: Configuration > Development > Environment Indicator Settings

Environment Switcher

The module comes bundled with a handy little tool called Environment Indicator Switcher which provide links to the current page on other server environments, see the "Open on..." menu items at the top of the screenshot below.

environment switcher settings screenshot

The settings for Environment Switcher can be found at /admin/config/development/environment-indicator/switcher or through the menu system: Configuration > Development > Environment Indicator Settings, then click the tab labelled Environment Switcher. Click the Add Environment button and complete the form shown in the screenshot above. Do this for any server environments you may wish to link to.

Environment Indicator UI

(brief, short)

If you have any comments or a particular topic in mind for a future article, or if you'd like to explore contracting possibilities, please get in touch.