public function ImportForm::submitForm in Default Content Deploy 8
Form submission handler.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Throws
\Exception
Overrides FormInterface::submitForm
File
- src/
Form/ ImportForm.php, line 148
Class
- ImportForm
- Config Form for run DCD deploy in Admin UI.
Namespace
Drupal\default_content_deploy\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$force_override = $form_state
->getValue('force_override', FALSE);
$folder = $form_state
->getValue('folder');
$file = $form_state
->getValue('file');
try {
if ($file) {
$this->importer
->setFolder($this->fileSystem
->getTempDirectory() . '/dcd/content');
$this->deployManager
->uncompressContent($file);
}
else {
$this->importer
->setFolder($folder);
}
$this->importer
->setForceOverride($force_override);
$this->importer
->prepareForImport();
$this
->addResultMessage();
$this->importer
->import();
} catch (\Exception $exception) {
$this->messenger
->addError($exception
->getMessage());
}
}