public function ThemeAdminForm::buildForm in Drupal 8
Same name and namespace in other branches
- 9 core/modules/system/src/Form/ThemeAdminForm.php \Drupal\system\Form\ThemeAdminForm::buildForm()
Form constructor.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
Overrides ConfigFormBase::buildForm
File
- core/
modules/ system/ src/ Form/ ThemeAdminForm.php, line 32
Class
- ThemeAdminForm
- Form to select the administration theme.
Namespace
Drupal\system\FormCode
public function buildForm(array $form, FormStateInterface $form_state, array $theme_options = NULL) {
// Administration theme settings.
$form['admin_theme'] = [
'#type' => 'details',
'#title' => $this
->t('Administration theme'),
'#open' => TRUE,
];
$form['admin_theme']['admin_theme'] = [
'#type' => 'select',
'#options' => [
'' => $this
->t('Default theme'),
] + $theme_options,
'#title' => $this
->t('Administration theme'),
'#description' => $this
->t('Choose "Default theme" to always use the same theme as the rest of the site.'),
'#default_value' => $this
->config('system.theme')
->get('admin'),
];
$form['admin_theme']['actions'] = [
'#type' => 'actions',
];
$form['admin_theme']['actions']['submit'] = [
'#type' => 'submit',
'#value' => $this
->t('Save configuration'),
'#button_type' => 'primary',
];
return $form;
}