在我的drupal项目中,我已经有了一个内容类型。
我目前正在自己的模块上工作,并希望创建一个内置的内容类型。有没有一种方法可以将我在drupal中直接构建的内容类型转换为代码?一种内容类型代码生成器?
如果可能的话,我想自动生成这段代码。
$t = get_t();
// Define the node type.
$slider = array(
'type' => 'slider',
'name' => $t('Slider Content'),
'base' => 'node_content',
'description' => $t('This is an example node type with a few fields.'),
'body_label' => $t('Example Description')
);
// Complete the node type definition by setting any defaults not explicitly
// declared above.
// http://api.drupal.org/api/function/node_type_set_defaults/7
$content_type = node_type_set_defaults($slider);
node_add_body_field($content_type);
// Save the content type
node_type_save($content_type);
非常感谢。
https://stackoverflow.com/questions/18564943
复制相似问题