开发者

How to add a CCK field-type in a form?

开发者 https://www.devze.com 2023-02-15 21:23 出处:网络
Hi I\'m having the following issue (or misunderstanding): I\'m registering a path (using hook_menu in a custom module), let\'s say the path is admin/some_settings. On this page I\'m supposed to show a

Hi I'm having the following issue (or misunderstanding): I'm registering a path (using hook_menu in a custom module), let's say the path is admin/some_settings. On this page I'm supposed to show a form with some file (images) upload fields.

I know how to this with standard field-types from Drupal but I want to add some CCK field-types (again they will be images). The reason for using CCK field types is I want to impose restrictions (file types, size, resolution etc.).

I also know how to do this with CCK for a content type but I don't know hot to do it for a registered menu. So any开发者_开发技巧 ideas or resources (just for the record: I've been using Drupal for 2 weeks so bear with me)?

Update: I think i found a solution now I only need an example. The solution is to find a module that has in the settings form a field that looks like something I'm looking for. Then I only need to look at the implementation. If anyone knows amodule that has an upload image field (imagefield preferably) in the settings menu let me know.


http://groups.drupal.org/node/16542

http://coder1.com/articles/adding-cck-field-to-custom-form

Hope this gives you a starting point.


I think this is not possible in Drupal-6. CCK fields were built to be attached to nodes. But thanks to the new Drupal-7 fields and entities things are easier now.

0

精彩评论

暂无评论...
验证码 换一张
取 消