By newbstah on
Hi There -
Am trying to figure out how to alter or update an existing cck field programmatically. (I'm trying to use as many search terms in this post as possible because I couldn't find how to do this, but I could find creating a node programmatically easily.) It's got to be pretty common thing to do. Can anyone point me in the right direction?
It's gotta be out there...
Thanks to anyone who can help!
Comments
DId you ever find an answer?
I want to update some cck fields programatically but so far have not found any info on this. Did you have any luck? Thanks,
A Young
Vancouver, BC
http://www.adamtyoung.ca
Adam Young
Vancouver, BC
http://www.adamtyoung.ca
Found this one
I got the same question and found this here:
http://civicactions.com/blog/cck_import_and_update
Let me know if you have any other helpful ressource/solution.
Am working on this as well
Have not found a good solution. Updating the tables directly works (post above), but it causes problems with caching. The new values are in the database but node_load returns the old values. Only after emptying the cache, the new value is available on node_load. I think the only viable solution is to handle this via drupal_process_form. Im am working on this but have not solved the problem. Please let me know if you have made any progress on this. thanks.
content_field_instance_ functions
I found the answer in http://rebcreative.com/files/cck_prog_slides.pdf. The relevant API functions are http://drupalcontrib.org/api/function/content_field_instance_read and http://drupalcontrib.org/api/function/content_field_instance_update. Caching can be dealt with via drupal_flush_all_caches(), although that might be overkill.