Skip to main content
added 401 characters in body
Source Link
CamilB
  • 258
  • 1
  • 8

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.

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?

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.
removed "Drupal" and tags from the title
Source Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

Setting site name in installation profile in Drupal 8

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 PHPExecute PHP after the site is installed.

Another option I tried is to override system.site.ymloverriding 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?

Setting site name in installation profile in Drupal 8

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 to override 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?

Setting site name in installation profile

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?

Source Link
CamilB
  • 258
  • 1
  • 8

Setting site name in installation profile in Drupal 8

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 to override 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?