public function ImportForm::submitForm in Term CSV Export Import 8
Same name and namespace in other branches
- 8.3 src/Form/ImportForm.php \Drupal\term_csv_export_import\Form\ImportForm::submitForm()
- 8.2 src/Form/ImportForm.php \Drupal\term_csv_export_import\Form\ImportForm::submitForm()
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.
Overrides FormInterface::submitForm
File
- src/
Form/ ImportForm.php, line 137
Class
- ImportForm
- Class ImportForm.
Namespace
Drupal\term_csv_export_import\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
switch ($this->step) {
case 1:
if ($form_state
->getValue('vocabulary') != 'create_new') {
$this->step++;
$this->userInput['vocabulary'] = $form_state
->getValue('vocabulary');
}
$this->userInput['preserve_vocabularies'] = $form_state
->getValue('preserve_vocabularies');
$this->userInput['input'] = $form_state
->getValue('input');
$form_state
->setRebuild();
break;
case 2:
$this->vocabulary = $this
->createVocab($form_state
->getValue('vid'), $form_state
->getValue('name'));
$this->userInput['vocabulary'] = $this->vocabulary;
$form_state
->setRebuild();
break;
case 3:
$import = new ImportController($this->userInput['input'], $this->userInput['vocabulary']);
$import
->execute($this->userInput['preserve_vocabularies']);
break;
}
$this->step++;
}