function FileModuleTestForm::submitForm
Same name in other branches
- 8.9.x core/modules/file/tests/file_module_test/src/Form/FileModuleTestForm.php \Drupal\file_module_test\Form\FileModuleTestForm::submitForm()
- 10 core/modules/file/tests/file_module_test/src/Form/FileModuleTestForm.php \Drupal\file_module_test\Form\FileModuleTestForm::submitForm()
- 11.x core/modules/file/tests/file_module_test/src/Form/FileModuleTestForm.php \Drupal\file_module_test\Form\FileModuleTestForm::submitForm()
Overrides FormInterface::submitForm
File
-
core/
modules/ file/ tests/ file_module_test/ src/ Form/ FileModuleTestForm.php, line 71
Class
- FileModuleTestForm
- Form controller for file_module_test module.
Namespace
Drupal\file_module_test\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
if ($form['#tree']) {
$uploads = $form_state->getValue([
'nested',
'file',
]);
}
else {
$uploads = $form_state->getValue('file');
}
if ($form['nested']['file']['#extended']) {
$uploads = $uploads['fids'];
}
$fids = [];
foreach ($uploads as $fid) {
$fids[] = $fid;
}
\Drupal::messenger()->addStatus($this->t('The file ids are %fids.', [
'%fids' => implode(',', $fids),
]));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.