开发者

Drupal 6 Module Developement - Multiple Node Types, Perms & Access

I'm wondering how to declare permissions and access for more than one defined node type in开发者_开发百科 a module. I'm guessing that as hook_node_info() returns the array like it does then more than one node type can be declared as part of the array but I'm stumped with regards to hook_perm() and hook_perm(). How do I separate the permissions in these hooks for each node type?


Take a look at my explanation in this answer to a similar question. The gist is that you do not need to declare your own node permissions, as the node module will create the 'standard' node permission set for every node you introduce automatically.

If you need additional permissions, just return them from hook_perm all at once.


I'd suggest creating submodules, i.e. your mymodule folder would have mymodule.module, which would depend on mymodule_type1.module and mymodule_type2.module (which could be in the same folder, or separated out into separate module folders if you prefer).


You might want to look into Features - a system of bundling modules, node types, permissions and other things all together into a single installable unit.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜