hook_form_alter() does not work for the contact form? I have contact form module enabled from core drupal 8 modules.

When I use the below code it has

   $form['field_consumer_name']['widget'][0]['#title'] = 'Individual Name';


I want that this code which I have written should override default title but it does not .
I would be interested in knowing how I can override title?

 function referral_q_form_contact_message_referral_form_form_alter(&amp;$form, \Drupal\Core\Form\FormStateInterface $form_state ) {
   // print_r($form['field_consumer_name']['widget'][0]['#title']);
$form['field_consumer_name']['widget'][0]['#title'] = 'Consumer Name Works';

   $form['#prefix'] = '&lt;div class="referral-container"&gt;';

   $form['field_consumer_name']['widget'][0]['#title'] = 'Individual Name';
   $form['field_referral_date']['widget'][0]['#title'] = 'Date';

   $form['field_diagnostic_code_1']['widget'][0]['#title'] = 'Diagnostic Code';

   _referral_q_remove_radio_na($form['field_veteran']);

   $form['#suffix'] = '&lt;/div&gt;';
 }
This is the array structure of the relevant part of the form.


  


Using `$form['field_consumer_name']['widget'][0]['value']['#title'] = 'Individual Name'; worked for me.