[development] programatically adding a CCK field to a content type.
nitingupta.iitg at gmail.com
Mon Sep 21 18:28:51 UTC 2009
Can you please post the code to do such validations about other modules and
field being exisiting already, so that I don have to re-invent the wheel.
Nitin Kumar Gupta
On Mon, Sep 21, 2009 at 11:50 PM, Emma Irwin <emma.irwin at gmail.com> wrote:
> This has worked for me as well, and I haven't had any issues. Testing with
> install/uninstall is important as is considering that that CCK field name
> might already exist.
> On Mon, Sep 21, 2009 at 3:51 AM, nitin gupta <nitingupta.iitg at gmail.com>wrote:
>> I wanted to add an imagefield to a content type, using the function
>> content_field_instance_create(). I wrote this piece of code.
>> $field['field_name'] = 'myfield';
>> $field['type_name'] = 'story';
>> $field['type'] = 'filefield';
>> $field['widget_type'] = 'imagefield_widget';
>> module_load_include('inc', 'content', 'includes/content.crud');
>> This works perfectly fine with me, and an imagefield gets added to the
>> content type. are there any pitfalls in this i should take care of? or is
>> there any better way to do such a thing?
>> Nitin Kumar Gupta
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the development