Hello Everyone,
My team is working on providing NetBeans support for Drupal. As a part of this, I am currently involved in writing a plugin in NetBeans, which would assist in coding a module. The plugin is a wizard which would ask for a module name and on clicking finish button, would generate the new module folder along with the necessary files and code templates.
I wanted help in this aspect. As per my understanding, <modulename>.info, <modulename>.install and <modulename>.module are the mandatory files in a module, right? Also, what would be the boilerplate code that I can put inside these files?
Thank for the help in advance.
With Regards, Sujit Nair
Strictly speaking, the .info is the only file that absolutely must be there. That's how Drupal finds the module. The .module file will get included by Drupal automatically on every page load (Drupal 6 and earlier). The .install file is where the install, update, and uninstall hooks must live, if they exist. If they do not exist, then that file doesn't have to exist.
The handbook has the format for info files, and api.drupal.org has the format for the install hooks. .module files can contain all sorts of wacky things. :-)
On Sunday 25 May 2008, Sujit wrote:
Hello Everyone,
My team is working on providing NetBeans support for Drupal. As a part of this, I am currently involved in writing a plugin in NetBeans, which would assist in coding a module. The plugin is a wizard which would ask for a module name and on clicking finish button, would generate the new module folder along with the necessary files and code templates.
I wanted help in this aspect. As per my understanding, <modulename>.info, <modulename>.install and <modulename>.module are the mandatory files in a module, right? Also, what would be the boilerplate code that I can put inside these files?
Thank for the help in advance.
With Regards, Sujit Nair
On Mon, 26 May 2008 09:36:07 +0530 Sujit Sujit.Nair@Sun.COM wrote:
Hello Everyone,
My team is working on providing NetBeans support for Drupal. As a part of this, I am currently involved in writing a plugin in NetBeans, which would assist in coding a module. The plugin is a wizard which would ask for a module name and on clicking finish button, would generate the new module folder along with the necessary files and code templates.
I wanted help in this aspect. As per my understanding, <modulename>.info, <modulename>.install and <modulename>.module are the mandatory files in a module, right?
I wouldn't say .install is mandatory but it could be nice to have a mock-up one.
Also, what would be the boilerplate code that I can put inside these files?
I think the only thing that have a pretty standard structure is the .info file. You'll surely need a .module file too, but it is hard to think about some mock-up code that could help. You could write a mocku-up menu with all the path containing "modulename" and provide the hook for /admin/settings/, /node/add/, edit, help etc... But not all modules will provide nodes... or even menu...
You could provide more than one template or "part" for "node" modules, "admin", "JavaScript", css, tpl.php... and maybe you'll end up in more useful mocku-up code.
I'd make the creation of .install optional since a module may not need it.