我正在尝试从模块中添加新的内容类型,而且我几乎从ubercart产品套件模块中借用了它,因为我想将它作为这种新类型的基础:
/**
* Implementation of hook_node_info().
*
* @return Node type information for flexible product bundles.
*/
function amh_shop_bundles_node_info() {
return array(
'amh_shop_flexi_bundle' => array(
'name' => t('Flexible Product Bundle'),
'module' => 'amh_shop_bundles',
'description' => t('This node represents a flexible bundle package that allows customers to mix and match products and get discounts.'),
'title_label' => t('Name'),
'body_label' => t('Description'),
),
);
}
但是,此新内容类型未在我的内容类型列表中列出。我知道模块正确加载,因为我还创建了一个函数amh_shop_bundles_perm()来列出权限,它们按预期包含在用户权限列表中。
我错过了什么吗? (嗯,很有可能,是的)。 Drupal documentation说它应该真的那么容易。
更新
我发现了一条评论,通过访问/ admin / content / node-type / amh-shop-flexi-bundle
来测试内容类型是否正确生成这很有效 - 但内容类型仍未与其他类型一起列出。
更新2:
由于我可以访问/ node / add / amh-shop-flexi-bundle中的空白节点表单,我想我可以继续实现其他钩子 - 并发现你需要实现hook_form()来列出内容类型
答案 0 :(得分:3)
实现hook_form()的技巧为我做了诀窍!
我添加了这些行,并添加了baam:
function hook_form(){
$form = array();
return $form;
}