[Drupal] About the rule of function name in Drupal

If you are creating a function that you intend to be strictly private (i.e. no other module should rely on it being a stable function or call it), start the function name with "_your_module_name_". If your function is public (i.e. it would be OK for another module to call it, and you don't intend to change its argument signature or behavior often), start the function name with "your_module_name_". If you are implementing a Drupal hook, you must always name the function "your_module_name_hookname". Likewise, if you are not implementing a Drupal hook, check the hooks to be sure you have not accidentally picked a function name matching a hook.

 

In other words:

private: _your_module_name_

public: your_module_name_

hook: your_module_name_hookname

free func: some_name_no_hook

posted @ 2010-10-20 15:20  DavidHHuan  阅读(273)  评论(0编辑  收藏  举报