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. <br><br><div class="gmail_quote">On Mon, Sep 21, 2009 at 3:51 AM, nitin gupta <span dir="ltr"><<a href="mailto:nitingupta.iitg@gmail.com">nitingupta.iitg@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi,<div><br>I wanted to add an imagefield to a content type, using the function content_field_instance_create(). I wrote this piece of code.<div>
<br>$field['field_name'] = 'myfield'; </div><div>$field['type_name'] = 'story'; </div>
<div>$field['type'] = 'filefield'; </div><div>$field['widget_type'] = 'imagefield_widget'; </div><div>module_load_include('inc', 'content', 'includes/content.crud'); </div>
<div>content_field_instance_create($field);</div><div><br></div><div>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?</div>
<div><br></div><div>Thanks,</div><div><br>--<br>Regards,<br>Nitin Kumar Gupta<br><a href="http://publicmind.in/blog/" target="_blank">http://publicmind.in/blog/</a><br></div></div>
</blockquote></div><br>