0
votes

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.

2
I think they're both refering to the same concept. It is just 2 different ways to talk about the same thing. - Djouuuuh
@Djouuuuh yea their functionality are same but what I thought that is there any difference or not :) - Ron
Oh ok. Indeed, there is no difference. You just replace the "hook" word in "hook_form_submit" by the name of your module. It is the equivalent of "theme" in the expressions "theme_preprocess_html" for example, where you replace the word "theme" by the name of your theme. - Djouuuuh

2 Answers

1
votes

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;
}
0
votes

It is the same thing, probably you read so many stuff but there is only one function.