So, im interested in creating my own custom module for drupal for my intranet based needs. So far i have followed the node_example module tutorial in the HEAD documentation and was very happy to see that everything worked fine. Another good source (if not a little outdated for drupal 5) is http://www-128.ibm.com/developerworks/ibm/osource/index.html - Written by employee's of IBM, this is a great tutorial that explains some more advanced module / theme ect development for drupal. With these tutorials and the drupal API documentation you would think it is going to be pretty smooth sailing but alas this is not the case.

I have been browsing the web looking for some kind of comprehensive tutorials on module devlopment but not had much joy. Ive seen all the great modules developed by the drupal community and i cant help but wonder, where did they go after completing the node_example tutorial? how did they get to the stage of creating such powerful modules? where did they get their information?

Im a pretty confident with PHP and MYSQL so writing custom code for my own, non-drupal applications is pretty straight forward but when it comes to writing modules for drupal i cant seem to create basic functions for my custom module =/

Im going to lead my thread at this point and see if i get any pointers in where to go and maybe later explain a little more about the requirements of my module. I may get all the help i need here in the forums! =)

Best regards,

Harris

Comments

AjK’s picture

where did they go after completing the node_example tutorial? how did they get to the stage of creating such powerful modules?

Short answer, reading the source code of those powerful modules. Once you have the "antaomy" of a modules construction reading other peoples modules makes a lot more sense.

Also, Core is VREY USEFUL. I remember back thinking "how do you ge those tabs on user profiles?" Answer, read the profile.module and it all becomes clear. Knowing what Drupal already has can be half the battle as it gives you pointers to find out how to get stuff done.

failing that, there's always the forums which offer a lot of help.

hazamonzo’s picture

That sounds like a good start for me then.

Maybe i could go into more detail about my module and what im trying to achieve at a basic level?>

I need to create a system that keeps track of personnel. The basic fields are listed below:

honourific_title (mr, mrs, miss ect)
first_name
last_name
date_of_birth
.....ect

As you can see these are basic attributes and can be stored in a single table. So following the node_example i create a simple module that includes all the basic functions, access_hook, form_hook, insert_hook, delete_hook, view_hook ect ect

I then test this basic module and as i expect i can add personnel to my database. Now i know what you are thinking. "why doesnt he use CCK?" Well, i want to make this module do more! and it requires a good relational database structure that i do not want to be dictated by CCK. Now for more fields :)

When im adding someone to the database i also want to include what skills they have and these skills with be in certain categories. The fields look something like this:

Website Developer
-HTML (tickbox)
-XHTML (tickbox)
-PHP (tickbox)
-MySQL (tickbox)
-Javascript (tickbox)
Website Designer
-Flash (tickbox)
-Photoshop (tickbox)
-CSS (tickbox)

ect ect ect,

This list of "skils" is only a tiny example and the list is going to be big. I also want to ability to be able to add more categories and more skills to those categories. This i think requires another node_type called "skills" and the list of skills will be added / stored in another seperate table. Now, these table relate in a many-to-many relationship, many people can have many skills.

Creating these two node types is pretty straight forward. the tricky part (for me anyhow being a Drupal module "n00b") is linking these tables together in the one "add_personnel" form. and again when viewing this information. I know i can use CCK to add these skill fields but i am reluctant to allow CCK to put these skills in the same table as the actual personnel data. I mean, if i have 1000 skills to choose from then im going to have one big table with many fields. That why i want to keep the personnel basic information and skills information seperate and instead use SQL to link these table together. I hope my explanation is too bad but im pretty stuck on how to move on and although the CCK module is very good, im more interested in building my own modules.

To summarise, Im looking for current module developers that are willing to take this n00b under their wing and maybe assist, not with the actual coding but pointers in the right direction.

Is there a module developer with the time to stand up to this task and help me get upt to speed with module development in Drupal? :)

Best regards,

Harris