public function AuditFilesManagedNotUsed::submitForm in Audit Files 8.3
Same name and namespace in other branches
- 8 src/Form/AuditFilesManagedNotUsed.php \Drupal\auditfiles\Form\AuditFilesManagedNotUsed::submitForm()
- 8.2 src/Form/AuditFilesManagedNotUsed.php \Drupal\auditfiles\Form\AuditFilesManagedNotUsed::submitForm()
- 4.x src/Form/AuditFilesManagedNotUsed.php \Drupal\auditfiles\Form\AuditFilesManagedNotUsed::submitForm()
Submit form delete file managed record.
Overrides FormInterface::submitForm
File
- src/
Form/ AuditFilesManagedNotUsed.php, line 239
Class
- AuditFilesManagedNotUsed
- Form for Managed not used functionality.
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'),
'op' => 'del',
'confirm' => TRUE,
];
$form_state
->setStorage($storage);
$form_state
->setRebuild();
}
}
if (!isset($storage)) {
$this
->messenger()
->addError($this
->t('No items were selected to operate on.'));
}
}
}