I have webform component labels like this:
Did [your pet] have any illnesses?
and I want to replace [your pet] with a variable token?
Do I need to write a custom module or can I do this by editing one of the theme .tpl files?
Tried this code as suggested:
<?php /* * Implementation of hook_form_alter() */ drupal_set_message(t('Outwith the hook'), 'warning'); // display outwith the hook function wit_bootstrap_form_alter(&$form, &$form_state, $form_id) { drupal_set_message(t('Inside the hook'), 'warning'); // display within the hook // target my form / my field if ($form_id == "webform_client_form_1") { // target my form / my field if ($form['neutered']['#title']) { $title = $form['neutered']['#title']; $token_val = 'freelo';//get_tokenised_value(); // Which ever way you handle that... $title = str_replace('[your pet]', $token_val, $title); $form['neutered']['#title'] = $title; } } }