I would like to extract the value entered by the user in a form to use it in a custom module. I use Drupal 8.5.1 and Webform 8.x-5.0-rc10. Thanks!
If you are using a form alter hook you can user
$form_state->getValue('element_name'). If you are want to get the final submission's data you could do...
$form_object = $form_state->getFormObject(); $webform_submission = ($form_object instanceof WebformSubmissionForm) ? $form_object->getEntity() : NULL; $value = $webform_submission->getElementData('element_name');