我的模块定义了一个自定义字段类型hook_field_info()
。在hook_install()
此模块中,我正在尝试创建此自定义字段类型的新字段和实例:
function my_module_install() {
if (!field_info_field('my_field')) {
$field = array(
'field_name' => 'my_field',
'type' => 'custom_field_type',
'cardinality' => 1
);
field_create_field($field);
}
}
代码在以下位置崩溃field_create_field($field)
:
WD php: FieldException: Attempt to create a field of unknown type custom_field_type. in field_create_field() (line 110 of [error]
/path/to/modules/field/field.crud.inc).
Cannot modify header information - headers already sent by (output started at /path/to/drush/includes/output.inc:37) bootstrap.inc:1255 [warning]
FieldException: Attempt to create a field of unknown type <em class="placeholder">custom_field_type</em>. in field_create_field() (line 110 of /path/to/modules/field/field.crud.inc).
怎么了?