I have written a custom handler in Drupal 8 D8 that grabs submitted data from a webform and reformats it and sends it to a JSON webservice. That is all working perfectly. My issue is that the submitted data from 2 of the dropdowns is an integer (the key of the dropdown), rather than the value of the drop down, like it was when in D7 I called:
$components = $node->webform['components'];
which gave me the value of the data from the dropdowns. Now I am calling:
$values = $webform_submission->getData();
Which gives me the submission data. However, what I need to do is translate the number to the value. For example:
for a component (or element) drop down called 'numbers' the options are: 1|One 2|Two 3|Three
When I grab the submission data I get "1" but I want to send the word "One".
How do I load the dropdown element to translate the value '1' to the word "One" in Drupal 8?