I have a quite complex form based on DrupalCoreFormFormBase with many (partially nested) fields and want to send the full contents in an email on submit.
Currently I have
public function submitForm(array &$form, FormStateInterface $form_state) {     foreach ($form_state->getValues() as $key => $value) {      if (!empty($form[$key]['#title']) && $key != 'images') {        $values[$form[$key]['#title']->render()] = $value;      }    } ... # later I will format the $values array as a HTML list 
This would only show fields on the top-level of the form, but I have fields within groups.
Is there a nice and clean way to render all the field’s values? Or do I have to iterate and parse manually over the $form array?
Could I even use a renderer for this?