public function AuditFilesUsedNotManaged::submitForm in Audit Files 4.x
Same name and namespace in other branches
- 8.3 src/Form/AuditFilesUsedNotManaged.php \Drupal\auditfiles\Form\AuditFilesUsedNotManaged::submitForm()
- 8 src/Form/AuditFilesUsedNotManaged.php \Drupal\auditfiles\Form\AuditFilesUsedNotManaged::submitForm()
- 8.2 src/Form/AuditFilesUsedNotManaged.php \Drupal\auditfiles\Form\AuditFilesUsedNotManaged::submitForm()
Submit handler for confirmation.
Overrides FormInterface::submitForm
File
- src/
Form/ AuditFilesUsedNotManaged.php, line 229
Class
- AuditFilesUsedNotManaged
- Class for file used but not managed.
Namespace
Drupal\auditfiles\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
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,
];
$form_state
->setStorage($storage);
$form_state
->setRebuild();
}
}
if (!isset($storage)) {
$this
->messenger()
->addError($this
->t('No items were selected to operate on.'));
}
}
}