function my_module_form_submit($form, FormStateInterface $form_state) { $values = $form_state->getValues(); // Do something with the submitted values }
function my_module_form_submit($form, FormStateInterface $form_state) { $name_value = $form_state->getValue('name'); // Do something with the 'name' value }In this example, we are using the getValue() method of the FormStateInterface to retrieve the submitted value of a specific form element with the name "name". Package library: Drupal Core.