0

I use hook_form_contact_site_form_alter to alter the Conact Form. Everyting works fine when I change the array, for example:

  $form['firstname'] = array (
    '#type' => 'textfield',
    '#title' => t('FirstName'),
    '#maxlength' => 255,
    '#required' => true

  );

dpm($form); shows me this:

enter image description here

So, thats perfect

... but nothing renders! Its still the good old default contact form: enter image description here

I was thinking, that maybe another hook overrides mine, or that I have to tell Drupal to rebuild the form. I haven't found anything usefuls in the API Reference yet.

Maybe somebody else had the same problem, or knows a good method to debug?

Thanks in Advance

btw. I had the contact_forms module installed, but uninstalled it again, maybe this is related.

4

1 回答 1

1

使用 时form_alter,不要忘记将第一个参数作为引用 ( &$form) 传递,否则$form一旦执行了函数,您的变量将不会被修改。

function hook_form_contact_site_form_alter(&$form, &$form_state, $form_id) {

}
于 2014-07-10T09:19:30.043 回答