function SiteInformationForm::buildForm
Same name in other branches
- 9 core/modules/system/src/Form/SiteInformationForm.php \Drupal\system\Form\SiteInformationForm::buildForm()
- 8.9.x core/modules/system/src/Form/SiteInformationForm.php \Drupal\system\Form\SiteInformationForm::buildForm()
- 11.x core/modules/system/src/Form/SiteInformationForm.php \Drupal\system\Form\SiteInformationForm::buildForm()
Overrides ConfigFormBase::buildForm
File
-
core/
modules/ system/ src/ Form/ SiteInformationForm.php, line 93
Class
- SiteInformationForm
- Configure site information settings for this site.
Namespace
Drupal\system\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$site_config = $this->config('system.site');
$site_mail = $site_config->get('mail');
if (empty($site_mail)) {
$site_mail = ini_get('sendmail_from');
}
$form['site_information'] = [
'#type' => 'details',
'#title' => $this->t('Site details'),
'#open' => TRUE,
];
$form['site_information']['site_name'] = [
'#type' => 'textfield',
'#title' => $this->t('Site name'),
'#default_value' => $site_config->get('name'),
'#required' => TRUE,
];
$form['site_information']['site_slogan'] = [
'#type' => 'textfield',
'#title' => $this->t('Slogan'),
'#default_value' => $site_config->get('slogan'),
'#description' => $this->t("How this is used depends on your site's theme."),
'#maxlength' => 255,
];
$form['site_information']['site_mail'] = [
'#type' => 'email',
'#title' => $this->t('Email address'),
'#default_value' => $site_mail,
'#description' => $this->t("The <em>From</em> address in automated emails sent during registration and new password requests, and other notifications. (Use an address ending in your site's domain to help prevent this email being flagged as spam.)"),
'#required' => TRUE,
];
$form['front_page'] = [
'#type' => 'details',
'#title' => $this->t('Front page'),
'#open' => TRUE,
];
$form['front_page']['site_frontpage'] = [
'#type' => 'textfield',
'#title' => $this->t('Default front page'),
'#default_value' => $this->aliasManager
->getAliasByPath($site_config->get('page.front')),
'#required' => TRUE,
'#size' => 40,
'#description' => $this->t('Specify a relative URL to display as the front page.'),
'#field_prefix' => $this->requestContext
->getCompleteBaseUrl(),
];
$form['error_page'] = [
'#type' => 'details',
'#title' => $this->t('Error pages'),
'#open' => TRUE,
];
$form['error_page']['site_403'] = [
'#type' => 'textfield',
'#title' => $this->t('Default 403 (access denied) page'),
'#default_value' => $site_config->get('page.403'),
'#size' => 40,
'#description' => $this->t('This page is displayed when the requested document is denied to the current user. Leave blank to display a generic "access denied" page.'),
];
$form['error_page']['site_404'] = [
'#type' => 'textfield',
'#title' => $this->t('Default 404 (not found) page'),
'#default_value' => $site_config->get('page.404'),
'#size' => 40,
'#description' => $this->t('This page is displayed when no other content matches the requested document. Leave blank to display a generic "page not found" page.'),
];
return parent::buildForm($form, $form_state);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.