I'm writing a custom installation profile/distribution and I want to pre-populate some fields in the 'Configure Site' form (/core/install.php
).
I have managed to prefill/preselect other fields like (Site name
, Site email address
and Default country
) but cannot preselect the Default time zone
field. This is the code I am using:
function mydistribution_form_install_configure_form_alter(&$form, FormStateInterface $form_state) {
$form['site_information']['site_name']['#default_value'] = 'Dummy Site Name';
$form['site_information']['site_mail']['#default_value'] = '[email protected]';
$form['regional_settings']['site_default_country']['#default_value'] = 'DE';
$form['regional_settings']['date_default_timezone']['#default_value'] = 'Europe/Berlin';
}
As you can see in the screenshot, I manage to change the Default country
successfully, but not the Default time zone
.
The "strange" thing though is that when I inspect the code, I can see that the correct timezone has been selected
but the form displays London
.
I'm based in the UK so I guess this is how London gets selected.
Does anyone know how to get this fixed? Thank you in advance!