2014-09-19 23 views

回答

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?'), 
); 
+0

你很好,它的工作非常完美。如何在上市時跳過第一個內容類型? – 2014-09-23 13:38:29

+0

你最好不要跳過它,但取消一個不需要的: $ options = node_type_get_names(); unset($ options ['article']); 其中'article'是您要刪除的內容類型。 – hugronaphor 2014-09-23 16:56:25

+0

還有一個問題: 如何將這些(選中的複選框)值插入到表中並在將來讀取? http://stackoverflow.com/questions/26039974/how-to-insert-into-database-drupal-custom-fields – 2014-09-25 13:35:03

相關問題