I'm creating an installation profile. Currently, hook_install()
contains only this:
/**
* Implements hook_install().
*/
function myprofile_install() {
\Drupal::service('config.factory')->getEditable('system.site')->set('name', 'My Site')->save();
}
Still, after installation is completed (using Drush) the site name is always "Drupal".
The code works if I paste it into Devel's Execute PHP after the site is installed.
Another option I tried is overriding system.site.yml within my profile, which won't load because I wrote uuid: ''
. (I don't know how to leave the already-generated UUID.)
How can I set the site name during installation in my custom profile?
EDIT: I found out the following:
- The site name gets overwritten when the install configuration form is submitted by Drush, using the values provided by Drush (including site name)
- The installation profile must provide a translation of the site information for each enabled language (I have more than one). I assume I'll do this with the core module Configuration Translate.