继续Drupal分享精神 QQ群:107748121 站长QQ:532116351【drupal交流+drupal 建站+theme制作】
登录 注册

Druapl cck hook 一些文档

最近在做cck 字段开发,因为默认没有这个功能,需要自己开发一些类型功能。
下面在开发的时候可能需要的 hook。具体可以参考http://drupal.org/node/342987
Required CCK hooks for CCK fields
CCK 字段开发必须的hook
* hook_field_info - To define new field type(s) in your module, use hook_field_info to tell CCK about those types. 这个hook 可以在你所开发的module里定义一个新的字段类型。比如image,多字段组合。告诉cck 关于这些类型。返回一个数组。

<?php

function hook_field_info() {
  return array(
   
'yourccktype' => array(
     
'label' => t('My cck field type'),
     
'description' => t('define title'),
    ),
  );
?>

具体例子可以参考, number.module 模块 定义的 number_integer, number_decimal, and number_float. 还有 text.module 定义的text类型。 这几个模块是学习开发cck field的典型模块
* hook_field 这个hook 主要设计到字段的操作 $op laod 加载,验证,presave 等操作。
* hook_field_formatter_info

Required CCK hooks for CCK widgets 使用的一些hook

* hook_widget 定义widget 的基本信息 可以在这里定义widget的一些基本表单

Optional CCK hooks

* hook_field_settings // 字段设定,这个主要是设置field一些预先的变量初始化设置。比如字段长度等等
* hook_widget_settings
* hook_widget_info
* hook_default_value
* ... many to be added ...

* CCK hook_default_value
* CCK hook_field
* CCK hook_field_info
* CCK hook_field_settings
* CCK hook_widget
* CCK hook_widget_info
* CCK hook_widget_settings

评论

发表新评论

此内容将保密,不会被其他人看见。
  • 自动将网址与电子邮件地址转变为链接。
  • 自动断行和分段。
  • You can use BBCode tags in the text.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

更多关於格式化选项的信息

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.