public function AuditFilesMergeFileReferences::submitForm in Audit Files 8.3
Same name and namespace in other branches
- 8 src/Form/AuditFilesMergeFileReferences.php \Drupal\auditfiles\Form\AuditFilesMergeFileReferences::submitForm()
- 8.2 src/Form/AuditFilesMergeFileReferences.php \Drupal\auditfiles\Form\AuditFilesMergeFileReferences::submitForm()
- 4.x src/Form/AuditFilesMergeFileReferences.php \Drupal\auditfiles\Form\AuditFilesMergeFileReferences::submitForm()
Submit form handler for Merge Records.
Overrides FormInterface::submitForm
File
- src/
Form/ AuditFilesMergeFileReferences.php, line 391
Class
- AuditFilesMergeFileReferences
- Form for merge file references.
Namespace
Drupal\auditfiles\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$this->configFactoryStorage
->getEditable('auditfiles.settings')
->set('auditfiles_merge_file_references_show_single_file_names', $form_state
->getValue('auditfiles_merge_file_references_show_single_file_names'))
->save();
if (!empty($form_state
->getValue('files'))) {
foreach ($form_state
->getValue('files') as $file_id) {
if (!empty($file_id)) {
$storage = [
'files' => $form_state
->getValue('files'),
'confirm' => TRUE,
'stage' => 'preconfirm',
];
$form_state
->setStorage($storage);
$form_state
->setRebuild();
}
}
if (!isset($storage)) {
$this
->messenger()
->addStatus($this
->t('At least one file name must be selected in order to merge the file IDs. No changes were made.'));
}
}
}