How can I add a field in Entityform / hook_form_alter I'm trying to add a field to the form in hook_form_alter. What's the proper way of adding fields in this hook in case of entityform?

I tried to add it this way:

$form['leadname'] = array(
    '#type' =&gt; 'hidden',
    '#value' =&gt; 'abc'
);


but I have the impression that this is not the way it should be done...
That is the way it should be done.

For example using

MODULE_form_ENTITYFORM_MACHINE_NAME_entityform_edit_form_alter(&amp;$form, &amp;$form_state) {}