钩子node_info 里面有很多设置属性,可以到这里http://api.drupal.org/api/function/hook_node_info/6 查找,有相关说明。
定义节点类型的名称和模块,描述等。下面一个locked 属性设置了不起作用,不知道是不是缓存问题,用drupal 6开发指南里面的例子joke,设置还是可以的,但是
更新一下就无效了。不知道是怎么回事。
* "name": the human-readable name of the node type. Required.
* "module": a string telling Drupal how a module's functions map to hooks (i.e. if module is defined as example_foo, then example_foo_insert will be called when inserting a node of that type). This string is usually the name of the module in question, but not always. Required.
* "description": a brief description of the node type. Required.
* "help": text that will be displayed at the top of the submission form for this content type. Optional (defaults to '').
* "has_title": boolean indicating whether or not this node type has a title field. Optional (defaults to TRUE).
* "title_label": the label for the title field of this content type. Optional (defaults to 'Title').
* "has_body": boolean indicating whether or not this node type has a body field. Optional (defaults to TRUE).
* "body_label": the label for the body field of this content type. Optional (defaults to 'Body').
* "min_word_count": the minimum number of words for the body field to be considered valid for this content type. Optional (defaults to 0).
* "locked": boolean indicating whether the machine-readable name of this content type can (FALSE) or cannot (TRUE) be edited by a site administrator. Optional (defaults to TRUE).
就按照上面的属性来定义了
array(
//product 就是模块名称 也是衔接名词 add/product 这样的路径
'name' =>t('产品信息'),
'module' => 'product',
'description' => t('添加公司相关产品信息'),
'has_title' => TRUE,
'title_label' => t('木材名称'),
'has_body' => TRUE,
'body_label' => t('材性及用途'),
'min_word_count' => 10,
'locked' => TRUE
)
);
}
?>
在后台创建内容下面应该可以看到菜单里。
每天进一步!
评论
发表新评论