After looking through the webform module I found out how to achieve this.
I used hook_webform_component_display_alter() which is there to enable customising the display of components in display only contexts. This function is in webform.api.php. I created my own function using this hook in a custom module to add the description to all textfield components as follows:
<?php
function my_mod_webform_component_display_alter(array &$element, array &$component) {
if ($component['type'] == 'textfield') {
$element['#description'] = $component['extra']['description'];
}
}
For reference, the notes and example given from the webform module for hook_webform_component_display_alter()
are:
/**
* Allow modules to modify a "display only" webform component.
*
* @param array $element
* The display element as returned by _webform_display_component().
* @param array $component
* A Webform component array.
*
* @see _webform_display_component()
*/
function hook_webform_component_display_alter(array &$element, array &$component) {
if ($component['cid'] == 10) {
$element['#title'] = 'My custom title';
$element['#default_value'] = 42;
}
}