public function ContentImport::submitForm in Content Import 8
Same name and namespace in other branches
- 8.9 src/Form/ContentImport.php \Drupal\contentimport\Form\ContentImport::submitForm()
- 8.3 src/Form/ContentImport.php \Drupal\contentimport\Form\ContentImport::submitForm()
- 8.4 src/Form/ContentImport.php \Drupal\contentimport\Form\ContentImport::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 ConfigFormBase::submitForm
File
- src/
Form/ ContentImport.php, line 76 - Contains \Drupal\contentimport\Form\ContentImport.
Class
- ContentImport
- Configure Content Import settings for this site.
Namespace
Drupal\contentimport\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$contentType = $form_state
->getValue('contentimport_contenttype');
$form_state_values = $form_state
->getValues();
$csvFile = $form_state
->getValue('file_upload');
$file = File::load($csvFile[0]);
$file
->setPermanent();
$file
->save();
ContentImport::createNode($contentType);
}