Because of a recent project I need to dig into this drupal thing and try to fix a bug inside.

I am a drupal CMS beginner,and studying this CMS for several days, also going through the drupal module development website.

But I still have no clue about how to do proper development in Drupal, especially the function naming, database table naming, and relationship between .module, .info and so on.

e.g. hook_revision_publish become revisioning_revision_publish

My question:

How are names mapped and what is the sequence of functions that are called (the workflow?)

Hope that my question is clear and help someone to shorten the learning path of Drupal.

Thank you very much in advance for helping.

2 Answers 2


From the sound of the question you are looking for a simple overview to help you get started. I would suggest that rather than initially tracing the way that the (labyrinthian) drupal core passes requests through functions, you should start with looking at how simple modules and themes connect to it to get an idea of the larger design pattern. Once you have an idea of the concepts and terminology used, the commented code examples are invaluable for this, giving examples of things you can do, and describing how to accomplish it.

Basically, as Djouuuuh points out, you can safely leave drupal core to do its thing. That is why you will work exclusively within the sites directory. Your interaction as a developer is to configure the installation to behave how you you would like (site building), create themes to customise display (theming) and create modules (development) to match very site-specific functionality. Always look to existing, supported modules first, it will save you a lot of time, even if must add to their functionality with your own module.

To understand the naming conventions for files and functions used in modules and themes, you will need to learn about the hook system and then look to the examples and the API(via google) to understand the uses of those hooks. More than likely you will rely heavily on just a few hooks to start with, for example hook_menu, hook_node_load, hook_form_alter (forms are a big subject).

Drupal.org holds extensive documentation about development methods.

Also Jeff Eaton of lullabot looks to have created a good slideshow on the subject of drupal development, which might be worth a click through.

  • Thanks for your response. I sort of understand the hook system (not very much) because I am coming from Wordpress development. And you are right, I am looking for an easy understanding of this "Drupal" thing. Your resources are very helpful and thank you very much for your response. Dec 10, 2014 at 15:18

I'm a bit surprised that you haven't found anything on the internet that could answer your questions. Here is an article about coding standards for Drupal.

Anyway, here are several things I always do with naming, functions and directories (that doesn't mean it's the best conventions):

  • The only directory you should work in is ./sites (please never ever edit something in the other directories).
  • The contribute modules you download should be placed in ./sites/all/modules/contrib
  • The custom modules that you develop yourself should be placed in ./sites/all/modules/custom
  • When you create a custom module, chose a simple and suitable name of it, preceded by the name of your project (better), for example myproject_blog.
  • The .module and .info files should have the same name as your module's, for example myproject_blog.module and myproject_blog.info. It will automatically make the relationship between them.
  • All the functions that appear in your .module file should be named by your module's name, for example myproject_blog_revision_publish().
  • If your custom module needs a table in your database, the name of your module has to show up somewhere, for example $schema['myproject_blog']. If you need more than one table, keep the prefix and add some explicit suffix.
  • Idem for the custom themes in ./sites/all/themes.

If I forgot something, just ask ;)

  • Thanks for the article link. I think, just like other programmers who get start in developing using Drupal, I am quite frustrated about how all the names are used. For example the $schema['myproject_blog'], my immediate question would be: where is it placed? Which function will use this variable or call this function? How is it being used? I also get mad when I saw this: revisioning_action_revision_trigger() what the heck is this? Thanks for your response. It helps. Dec 10, 2014 at 15:16
  • Mh I see. In my opinion, you'd better start at the beginning, and read a lot about Drupal, its UI, its contribute modules system, its entities (very important),... And only after, you can start to read about developing your custom module/theme, trying thing more and more complicated (don't bother you with the custom DB tables too soon). You will naturally understand the naming for the "hooks", that are just functions preceded by the word itself "hook" and that you have to replace by the name of your module/theme in which you work, simply ;)
    – Djouuuuh
    Dec 10, 2014 at 15:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.