public function AuditFilesReferencedNotUsed::submissionHandlerAddToFile in Audit Files 8.2
Same name and namespace in other branches
- 8.3 src/Form/AuditFilesReferencedNotUsed.php \Drupal\auditfiles\Form\AuditFilesReferencedNotUsed::submissionHandlerAddToFile()
- 8 src/Form/AuditFilesReferencedNotUsed.php \Drupal\auditfiles\Form\AuditFilesReferencedNotUsed::submissionHandlerAddToFile()
- 4.x src/Form/AuditFilesReferencedNotUsed.php \Drupal\auditfiles\Form\AuditFilesReferencedNotUsed::submissionHandlerAddToFile()
Submit form.
File
- src/
Form/ AuditFilesReferencedNotUsed.php, line 249
Class
- AuditFilesReferencedNotUsed
- Form for Files referenced not used functionality.
Namespace
Drupal\auditfiles\FormCode
public function submissionHandlerAddToFile(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,
'op' => 'add',
];
$form_state
->setStorage($storage);
$form_state
->setRebuild();
}
}
if (!isset($storage)) {
$this
->messenger()
->addError($this
->t('No items were selected to operate on.'));
}
}
}