TransWikia.com

How to change the name of site only for the developers?

Drupal Answers Asked on November 25, 2021

I am new on Drupal 8 , in order to change the site name and the slogan , I want to change the site name just for the developers used my website

is there any way to do that?

I have implemented a code but I want to do it for just developers , is there any hook any way to do that?

$config = Drupal::service('config.factory')->getEditable('system.site');
$config->set('name', "XXXXXXX"); 
$config->save();

One Answer

The most common way to use a settings.local.php file that is outside of your git repo. Each developer can use this to setup their local environment with local DB, etc.

I tend to have a settings.local.php.example file in the repo that dev can copy to their settings.local.php file.

This file can contain any Drupal overrides you want, e.g.: As Leymannx said: $config['system.site']['name'] = 'Foobar'.

See the docs on overrides for some details.

Drupal also has an example of settings.local.php.

You can also use this to do things like turn off caching and security checks locally.

NOTE: I think the current settings.php files automatically include a test / load for the settings.local.php file. If not, just search for how to make sure it gets loaded.

Answered by CG Monroe on November 25, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP