Form constructor for a site configuration form.
$install_state: An array of information about the current installation state.
install_configure_form_validate()
install_configure_form_submit()
function _install_configure_form($form, &$form_state, &$install_state) {
$form['site_information'] = array(
'#type' => 'details',
'#title' => st('Site information'),
);
$form['site_information']['site_name'] = array(
'#type' => 'textfield',
'#title' => st('Site name'),
'#required' => TRUE,
'#weight' => -20,
);
$form['site_information']['site_mail'] = array(
'#type' => 'email',
'#title' => st('Site e-mail address'),
'#default_value' => ini_get('sendmail_from'),
'#description' => st("Automated e-mails, such as registration information, will be sent from this address. Use an address ending in your site's domain to help prevent these e-mails from being flagged as spam."),
'#required' => TRUE,
'#weight' => -15,
);
$form['admin_account'] = array(
'#type' => 'details',
'#title' => st('Site maintenance account'),
);
$form['admin_account']['account']['#tree'] = TRUE;
$form['admin_account']['account']['name'] = array(
'#type' => 'textfield',
'#title' => st('Username'),
'#maxlength' => USERNAME_MAX_LENGTH,
'#description' => st('Spaces are allowed; punctuation is not allowed except for periods, hyphens, and underscores.'),
'#required' => TRUE,
'#weight' => -10,
'#attributes' => array(
'class' => array(
'username',
),
),
);
$form['admin_account']['account']['mail'] = array(
'#type' => 'email',
'#title' => st('E-mail address'),
'#required' => TRUE,
'#weight' => -5,
);
$form['admin_account']['account']['pass'] = array(
'#type' => 'password_confirm',
'#required' => TRUE,
'#size' => 25,
'#weight' => 0,
);
$form['server_settings'] = array(
'#type' => 'details',
'#title' => st('Server settings'),
);
$countries = Drupal::service('country_manager')
->getList();
$form['server_settings']['site_default_country'] = array(
'#type' => 'select',
'#title' => st('Default country'),
'#empty_value' => '',
'#default_value' => config('system.date')
->get('country.default'),
'#options' => $countries,
'#description' => st('Select the default country for the site.'),
'#weight' => 0,
);
$form['server_settings']['date_default_timezone'] = array(
'#type' => 'select',
'#title' => st('Default time zone'),
'#default_value' => date_default_timezone_get(),
'#options' => system_time_zones(),
'#description' => st('By default, dates in this site will be displayed in the chosen time zone.'),
'#weight' => 5,
'#attributes' => array(
'class' => array(
'timezone-detect',
),
),
);
$form['update_notifications'] = array(
'#type' => 'details',
'#title' => st('Update notifications'),
);
$form['update_notifications']['update_status_module'] = array(
'#type' => 'checkboxes',
'#options' => array(
1 => st('Check for updates automatically'),
2 => st('Receive e-mail notifications'),
),
'#default_value' => array(
1,
2,
),
'#description' => st('The system will notify you when updates and important security releases are available for installed components. Anonymous information about your site is sent to <a href="@drupal">Drupal.org</a>.', array(
'@drupal' => 'http://drupal.org',
)),
'#weight' => 15,
);
$form['update_notifications']['update_status_module'][2] = array(
'#states' => array(
'visible' => array(
'input[name="update_status_module[1]"]' => array(
'checked' => TRUE,
),
),
),
);
$form['actions'] = array(
'#type' => 'actions',
);
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => st('Save and continue'),
'#weight' => 15,
);
return $form;
}