function DispatchForm::submitForm
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
- 
              tests/modules/ rules_test_event/ src/ Form/ DispatchForm.php, line 75 
Class
- DispatchForm
- Acquires input, wraps it in a Task object, and queues it for processing.
Namespace
Drupal\rules_test_event\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
  $choice = $form_state->getValue('event');
  var_dump($choice);
  switch ($choice) {
    case 0:
      $event = new PlainEvent();
      break;
    case 1:
      $event = new GenericEvent('Test subject', [
        'publicProperty' => 'public property',
        'protectedProperty' => 'protected property',
        'privateProperty' => 'private property',
      ]);
      break;
    case 2:
      $event = new GetterEvent();
      break;
  }
  $this->dispatcher
    ->dispatch($event, $event::EVENT_NAME);
}