如何在Drupal的配置文件类型中将内容类型列为复选框

时间:2014-09-19 12:36:57

标签: drupal drupal-7 drupal-content-types

在drupal用户注册中,用户应该能够选择他们想要订阅的类型。那么,如何在自定义配置文件注册类型中列出内容类型(节点类型)?

http://i.stack.imgur.com/hvWd2.png

1 个答案:

答案 0 :(得分:0)

您可以使用node_type_get_names()功能检索所有内容类型。 所以,在hook_form_alter中添加:

$form['ct'] = array(
  '#type' => 'checkboxes',
  '#options' => node_type_get_names(),
  '#title' => t('What standardized tests did you take?'),
);
相关问题