Module Enlightenment

jastylr - December 3, 2008 - 01:35

Hello All,

I am relatively new to Drupal (Absolutely kick-a** cms in my opinion) and have a basic question regarding the development of modules. In many forum posts, articles etc. where someone is asking how to override built-in functionality such as adding or removing form fields or creating new content types without CCK, the response is often times "Write a custom module to do it". While this sounds fine and all, I may be missing the most basic piece of information. Would I need to create a separate module for each individual part of the core that I am trying to override or would I just have a single module (i.e. MyModule.module) that contains all of the various overrides for all forms or functions that I wish to change? I would assume that like a template.php file which contains all overrides at a theme level, an individual module would do the same thing but I'm not sure.

This may be a very basic and well understood part of module development but it has me stumped.

Thanks in advance for any help.

i'm pretty sure you can

karschsp - December 3, 2008 - 02:00

i'm pretty sure you can include all your "override" functionality in a single module.

steve

Thanks Steve, I would figure

jastylr - December 3, 2008 - 02:36

Thanks Steve, I would figure this as well as it wouldn't make sense to me to have a ton of individual modules to activate that simply override existing functionality. If I had 10 forms that I wanted to override, I wouldn't want to have 10 modules to accomplish the task. I would rather have a single module that looked for the specific forms in question and performed the modifications.

Jason

Yep, I just do something

jmburnz - December 3, 2008 - 02:39

Yep, I just do something like a custom_forms.module that handles them all.

Yes

Michelle - December 3, 2008 - 02:40

It's actually pretty common to have a site specific module (sitename.module) to handle all the little customizations you do to a site.

Michelle

--------------------------------------
See my Drupal articles and tutorials or come check out life in the Coulee Region.

Thanks to everyone for their

jastylr - December 3, 2008 - 02:48

Thanks to everyone for their comments. I think it totally makes sense to have a site specific module for overriding core functionality or perhaps multiple modules depending upon the complexity of the changes such as having all form related overrides in a MyForms.module or something like that.

Thanks again!

Yep

styro - December 3, 2008 - 04:03

If/when your site specific module starts getting bigger and more complex, you'll probably want to split it up into multiple modules for each main purpose.

eg you might have a module for taxonomy tweaks, or a module for CCK tweaks etc and leave all the small miscellaneous ones in your original module.

--
Anton

 
 

Drupal is a registered trademark of Dries Buytaert.