我试图从一个模块中添加一个新的内容类型,并且我借鉴了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()来列出内容类型。
发布于 2012-01-20 10:20:23
实现hook_form()的技巧帮了我大忙!
我只添加了以下几行,然后:
function hook_form(){
$form = array();
return $form;
}https://stackoverflow.com/questions/5710677
复制相似问题