开发者

Drupal 6: Make custom function available to different modules

开发者 https://www.devze.com 2023-02-15 14:59 出处:网络
I have a couple 开发者_JAVA技巧of custom PHP functions that I would like to make available to several modules I created.

I have a couple 开发者_JAVA技巧of custom PHP functions that I would like to make available to several modules I created.

What would be the drupal-correct way to get around this problem? Basically, I would like to avoid copying all those functions inside every module I have.


Well, you can't just copy the functions into every module because if you have two or more modules with those functions then you'll get PHP errors about the function already having been declared (unless you go through the effort of renaming them in each module).

The best way to go about it depends on your exact usage, but assuming they are a collection of related core or api functionality, then I would place these into a separate module and then any additional modules could have the core module as a dependency.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号