Download & Extend

Module to hold all the functions?

Project:CCK Formatters
Version:6.x-1.x-dev
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

A lot of my additions reuse the same functions, I should probably separate the CCK hooks from all of the functions, so that code doesn't get repeated. Is this the right way to go about this? If so what should I call the module that holds all the functions?

Comments

#1

Depends on the details of what you're doing. If the modules will all live in the same directory you can have a common include file that they all call module_load_include() on, which will automatically keep it from getting called multiple times. Unless it's a lot of code, though, it's probably not worth it. CCK formatters tend to have a lot of boilerplate code that's not worth trying to factor out. C'est la vie.

#2

Custom Formatters is pretty much based around this issue, it itself is just a shell for the CCK formatter hooks, whereas the formatters code is kept in the database.

#3

Um, what? Keeping code in the database is a generally bad idea. It's slower, harder to debug, and arguably a security risk. And since this module exists, er, why create another one?

#4

@Crell

Custom Formatters isn't another version of CCK formatters, it is a utility to create custom CCK formatters oppose to a collection of pre-made custom formatters. Therefore the database is the only place you could keep the data of the formatters.