function ConfigImportForm::buildForm
Same name in other branches
- 9 core/modules/config/src/Form/ConfigImportForm.php \Drupal\config\Form\ConfigImportForm::buildForm()
- 8.9.x core/modules/config/src/Form/ConfigImportForm.php \Drupal\config\Form\ConfigImportForm::buildForm()
- 10 core/modules/config/src/Form/ConfigImportForm.php \Drupal\config\Form\ConfigImportForm::buildForm()
Overrides FormInterface::buildForm
File
-
core/
modules/ config/ src/ Form/ ConfigImportForm.php, line 78
Class
- ConfigImportForm
- Defines the configuration import form.
Namespace
Drupal\config\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$directory = $this->settings
->get('config_sync_directory');
$directory_is_writable = is_writable($directory);
if (!$directory_is_writable) {
$this->messenger()
->addError($this->t('The directory %directory is not writable.', [
'%directory' => $directory,
]));
}
$form['import_tarball'] = [
'#type' => 'file',
'#title' => $this->t('Configuration archive'),
'#description' => $this->t('Allowed types: @extensions.', [
'@extensions' => 'tar.gz tgz tar.bz2',
]),
];
$form['submit'] = [
'#type' => 'submit',
'#value' => $this->t('Upload'),
'#disabled' => !$directory_is_writable,
];
return $form;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.