public function AuditFilesMergeFileReferences::submissionHandlerMergeRecord in Audit Files 8
Same name and namespace in other branches
- 8.2 src/Form/AuditFilesMergeFileReferences.php \Drupal\auditfiles\Form\AuditFilesMergeFileReferences::submissionHandlerMergeRecord()
Submit form.
File
- src/
Form/ AuditFilesMergeFileReferences.php, line 308
Class
Namespace
Drupal\auditfiles\FormCode
public function submissionHandlerMergeRecord(array &$form, FormStateInterface $form_state) {
\Drupal::configFactory()
->getEditable('auditfiles_config.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)) {
drupal_set_message($this
->t('At least one file name must be selected in order to merge the file IDs. No changes were made.'), 'error');
}
}
}