Hi,
I'm working on a node-type module development (I'm not using cck because of the complexity of nodes relations) and I'd like to integrate my node with image attach.

Image_attach for a node-type can be enabled by an administrator in the content types admin page, but I need to do that programmatically enabling my module.

With the help of devel module, I've seen that image_attach module add the field if the value of the variable image_attach_<nodetype> is 1 (with <nodetype> the type of your node).

So if I set the variable image_attach_<mytype> to 1 I think it could work, but where (in which function of the module) I should do that ? In hook_form, hook_alter, hook_node_info, install ??
(Setting into the hook_alter, if image_attach_alter is called before my hook_alter, the field will not appear... I think.... but I can be wrong...)

Thx in advance

Comments

digemall’s picture

Prefix:
I've noticed that my post was not so comprehensible because I forgot to escape the special characters "<" and ">".
Now I fixed it.

To come back to the topic... I've done it in hook_install through
variable_set("image_attach_mytype", 1)

I don't know whether it's the correct solution nor if it's stylystically bad, but for me it seems to work fine.