public function ImportForm::buildForm in Default Content Deploy 8
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 FormInterface::buildForm
File
- src/
Form/ ImportForm.php, line 76
Class
- ImportForm
- Config Form for run DCD deploy in Admin UI.
Namespace
Drupal\default_content_deploy\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$form['file'] = [
'#type' => 'file',
'#title' => $this
->t('Archive'),
'#description' => $this
->t('Upload a file if you want importing from archive.</br> <b>Important!!!</b> The structure should be the same as after export.'),
];
$form['folder'] = [
'#type' => 'textfield',
'#title' => $this
->t('Folder'),
'#description' => $this
->t('All existing content will be imported form this folder.'),
'#default_value' => $this->deployManager
->getContentFolder(),
'#states' => [
'visible' => [
':input[name="files[file]"]' => [
'value' => '',
],
],
],
];
$form['force_override'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Force override'),
'#description' => $this
->t('All existing content will be overridden (locally updated default content will be reverted to the state defined in a content directory).'),
'#default_value' => FALSE,
];
$form['import'] = [
'#type' => 'submit',
'#value' => $this
->t('Import content'),
];
return $form;
}