Drupal 钩子节点信息未将内容类型添加到我的列表中
我正在尝试从模块中添加一个新的内容类型,我几乎借用了ubercart产品工具包模块,因为我想将其用作此新类型的基础:Drupal 钩子节点信息未将内容类型添加到我的列表中,drupal,drupal-6,drupal-hooks,Drupal,Drupal 6,Drupal Hooks,我正在尝试从模块中添加一个新的内容类型,我几乎借用了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_
/**
* 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(),以列出权限,并且这些权限将按预期包含在用户权限列表中
我错过什么了吗?(很可能是的)。但专家说,这应该真的很容易
更新:
我发现了一条评论,它通过访问/admin/content/node-type/amh-shop-flexi-bundle来测试内容类型是否正确生成
这是可行的,但内容类型仍然没有与其他内容一起列出
更新2:
由于我可以在/node/add/amh shop flexi bundle上访问一个空白节点表单,我想我可以继续实现其他钩子,并发现您需要实现钩子表单()来列出内容类型。实现钩子表单()的技巧为我带来了窍门 我只添加了这些行,baam:
function hook_form(){
$form = array();
return $form;
}
那么,通过实现hook_form()您的问题解决了吗?然后请在单独的答案中写下你的答案,并接受你自己的答案。谢谢。公平点-我会这么做-但必须是明天,当我面前有代码可供参考时。抱歉-看起来此代码很久以前就被删除了,因为不再需要该模块,我很难在存储库中找到它。:(但在您的“更新2”中),有一个可能的简短答案-如果正确的话。我必须从头再来一次…但我真的没有时间,对不起-你可以试一试吗?