Form builder; The general site information form.
function system_site_information_settings($form, &$form_state) {
$site_config = config('system.site');
$site_mail = $site_config
->get('mail');
if (empty($site_mail)) {
$site_mail = ini_get('sendmail_from');
}
$form['site_information'] = array(
'#type' => 'details',
'#title' => t('Site details'),
);
$form['site_information']['site_name'] = array(
'#type' => 'textfield',
'#title' => t('Site name'),
'#default_value' => $site_config
->get('name'),
'#required' => TRUE,
);
$form['site_information']['site_slogan'] = array(
'#type' => 'textfield',
'#title' => t('Slogan'),
'#default_value' => $site_config
->get('slogan'),
'#description' => t("How this is used depends on your site's theme."),
);
$form['site_information']['site_mail'] = array(
'#type' => 'email',
'#title' => t('E-mail address'),
'#default_value' => $site_mail,
'#description' => t("The <em>From</em> address in automated e-mails sent during registration and new password requests, and other notifications. (Use an address ending in your site's domain to help prevent this e-mail being flagged as spam.)"),
'#required' => TRUE,
);
$form['front_page'] = array(
'#type' => 'details',
'#title' => t('Front page'),
);
$front_page = $site_config
->get('page.front') != 'user' ? drupal_container()
->get('path.alias_manager')
->getPathAlias($site_config
->get('page.front')) : '';
$form['front_page']['site_frontpage'] = array(
'#type' => 'textfield',
'#title' => t('Default front page'),
'#default_value' => $front_page,
'#size' => 40,
'#description' => t('Optionally, specify a relative URL to display as the front page. Leave blank to display the default front page.'),
'#field_prefix' => url(NULL, array(
'absolute' => TRUE,
)),
);
$form['error_page'] = array(
'#type' => 'details',
'#title' => t('Error pages'),
);
$form['error_page']['site_403'] = array(
'#type' => 'textfield',
'#title' => t('Default 403 (access denied) page'),
'#default_value' => $site_config
->get('page.403'),
'#size' => 40,
'#description' => t('This page is displayed when the requested document is denied to the current user. Leave blank to display a generic "access denied" page.'),
'#field_prefix' => url(NULL, array(
'absolute' => TRUE,
)),
);
$form['error_page']['site_404'] = array(
'#type' => 'textfield',
'#title' => t('Default 404 (not found) page'),
'#default_value' => $site_config
->get('page.404'),
'#size' => 40,
'#description' => t('This page is displayed when no other content matches the requested document. Leave blank to display a generic "page not found" page.'),
'#field_prefix' => url(NULL, array(
'absolute' => TRUE,
)),
);
$form['#validate'][] = 'system_site_information_settings_validate';
return system_config_form($form, $form_state);
}