public function RegcodeAdminManageForm::submitForm in Registration codes 8
Form submission handler.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Overrides FormInterface::submitForm
File
- src/
Form/ RegcodeAdminManageForm.php, line 49
Class
- RegcodeAdminManageForm
- Form for managing registration codes.
Namespace
Drupal\regcode\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$operations = $form_state
->getValue([
'regcode_operations',
]);
foreach ($operations as $operation) {
switch ($operation) {
case REGCODE_CLEAN_TRUNCATE:
regcode_clean(REGCODE_CLEAN_TRUNCATE);
$this
->messenger()
->addStatus($this
->t('All registration codes were deleted.'));
break;
case REGCODE_CLEAN_EXPIRED:
regcode_clean(REGCODE_CLEAN_EXPIRED);
$this
->messenger()
->addStatus($this
->t('All expired registration codes were deleted.'));
break;
case REGCODE_CLEAN_INACTIVE:
regcode_clean(REGCODE_CLEAN_INACTIVE);
$this
->messenger()
->addStatus($this
->t('All inactive registration codes were deleted.'));
break;
}
}
}