What's the difference between $form_id
and $form['#id']
in hook_form_alter()
? Why they have not the same values?
1 Answer
Next should make sense:
<form action="somepath" id="search-theme-form"> <!-- id = $form['#id'] -->
<input type="hidden" name="form_id" id="edit-search-theme-form" value="search_theme_form"/> <!-- value = $form_id -->
</form>
Terms:
#form['#id']
= store html form attribute id:
Used to populate form elements' id property. In rare cases, you can set this value yourself on a form element, to override the default setting.
$form_id
- point to Drupal form function name, in html it's form hidden element:
The unique string identifying the desired form. If a function with that name exists, it is called to build the form array.