有没有办法导出内容类型的表单结构并将其放在模块中,就像在视图中一样? (以及所有cck of course) $形式[ '项目'] = .....
答案 0 :(得分:1)
请参阅Features模块。创建功能时,可以包括节点类型,CCK,视图,ImageCache预设甚至模块依赖项。
答案 1 :(得分:0)
这听起来像你在这里更详细地寻找:
http://www.tinpixel.com/node/53
我也在我的网站上使用以下代码,该函数是install_profile api模块使用的方法的一个分支,我在我的网站上使用它而不是加载完整的模块:
http://drupal.org/project/install_profile_api
function MYMODULE_install_content_copy_import_from_file($file) { // The import will be populate into the $content variable. $content = array(); ob_start(); include $file; ob_end_clean(); $form_state['values']['type_name'] = ''; $form_state['values']['macro'] = '$content = '. var_export($content, 1) .';'; $form_state['values']['op'] = t('Import'); drupal_execute('content_copy_import_form', $form_state); }