Drupal 5: CCK fields in custom content type
Posted
by Kuroki Kaze
on Stack Overflow
See other posts from Stack Overflow
or by Kuroki Kaze
Published on 2010-03-22T15:27:00Z
Indexed on
2010/03/22
15:31 UTC
Read the original article
Hit count: 384
I have module that implements custom content type via NodeAPI hooks (hook_insert
, hook_update
etc). I want to add CCK field to this content type and populate it via hook_nodeapi calls like create or update (to show content nodes in Views).
Problem is, I cannot access CCK fields for this content type. Sure, it's enabled on "Manage Fields" page, but when I load any node of this type with Devel module, I cannot see field attribute (field_flag
) in node object. I can see it under "Dev Render" tab as part of "content" attribute, like $node->content['field_flag']['#value']
, but if I assign value to $node->field_flag
or $node->content['field_flag']['#value']
and call node_save
, CCK fields are not saved.
Maybe I must call some other function to save CCK fields? Or what may be wrong with this setup?
© Stack Overflow or respective owner