Search code examples
drupaldrupal-7

What is the basic difference between form_submit hook and hook_form_submit in Drupal 7


I have started working on drupal 7 few days ago ,while creating a custom module for my project I came across the form_submit hook in drupal 7 , as well as hook_form_submit.That is why I am little confused about the form submit for drupal.

Basically I need to know that what is the difference between orm_submit hook and hook_form_submit in Drupal 7 . If anyone could explain it elaborately it would be a great help .

Thanks in advance.


Solution

  • There is only one. Don't be confused between hook_form_submit, form_submit, drupal_form_submit, or whatever_form_submit, they are all... "form_submit hooks".

    This is the api for the hook:
    https://api.drupal.org/api/drupal/includes!form.inc/function/drupal_form_submit/7

    e.g. I have a module called awesome, and I want to use the hook, the function would be:

    function awesome_form_submit($form_id, &$form_state) {
      stuff;
    }