Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By robertDouglass on
Hi,
I'm having a difficult time figuring out exactly what happens when a form is submitted to Drupal. For example, on the edit account page, the form attribute action="/?q=user/edit". I assume this leads to a function call that builds a user object from the post parameters and updates the database. Where is this code? How is this explained generally? What combinations of ?q=object/action are there? Is there documentation on this somewhere that I've overlooked? Thanks for any info! The sooner I get a grip on all this the sooner I can start contributing code.
Comments
module_link()
To figure out where a certain page starts, start with a module's _link hook.
The menu()-calls define page urls, which are parsed from bottom to top (i.e. if "user/foo/bar" is requested, then it checks for "user/foo/bar", "user/foo" and "user" before throwing a 404). One of the parameters to menu() is the function which should handle a particular page. Often, multiple pages redirect to the same handler.
In your case:
menu('user/edit', t('edit account'), 'user_page', 0);
So look up user_page().
It starts here
Aha, that helps. Furthermore, I found the code that starts the whole process of reading the GET parameters. It is in common.inc
But what about the POST parameters? Where do they get marshalled into objects? Centrally? Or is each module individually responsible for that?
- Robert Douglass
-----
visit me at www.robshouse.net
yes, handled by modules
yes, each module reads POST params when it needs to.