Hi I am new(ish) to Drupal 8. I want to add a field to contact form and it is not working. The same code works when i add a field to a form generated with the form api.

My code is:
if($form_id == "contact-message-tell-us-form") {
drupal_set_message ("inside contact-message-tell-us-form");
$form['fun_text'] = array(
'#markup' => 'This should show but it does not',
'#weight' => -10
);
}

this is inside hook_form_alter

Thanks
Amir

Comments

VM’s picture

module development and code questions are better suited in the 'module development and code questions' forum Please edit your post and move it. Thank you.

Also of note, when submitting code to drupal.org please use code tags. Doing so aids with readability and insures none of your submission is stripped.