public function submitForm(array &$form, FormStateInterface $form_state) { $values = $form_state->getUserInput(); // Do something with the user input values }
use Drupal\Core\Form\FormStateInterface; function my_module_form_submit($form, FormStateInterface $form_state) { $values = $form_state->getUserInput(); // Do something with the user input values }This code is a sample submit function outside of a Drupal form class. It retrieves the user input values using `getUserInput()` method and stores those values in the `$values` variable. Package Library: The `getUserInput()` method is part of the Drupal Core Form package library.