在PHP中添加现有的Drupal7表单字段

在PHP中添加现有的Drupal7表单字段,php,drupal-7,textfield,content-type,drupal-theming,Php,Drupal 7,Textfield,Content Type,Drupal Theming,鉴于上述情况,文档中的何处显示了如何以编程方式(通过PHP)从不同内容类型添加现有表单字段的语法?您能详细说明一下吗?您是否正在尝试获取附加到内容类型的字段,并将其嵌入到任意表单中?或许可以看看field_attach API@布莱恩,是的;我有一个内容类型MyContentType,它包含一个文本列表、字段MyContentType下拉列表,当您转到www.mywebsite.web/node/123/confirmpage,一个featurename\u content\u类型而不是MyCo

鉴于上述情况,文档中的何处显示了如何以编程方式(通过PHP)从不同内容类型添加现有表单字段的语法?

您能详细说明一下吗?您是否正在尝试获取附加到内容类型的字段,并将其嵌入到任意表单中?或许可以看看field_attach API@布莱恩,是的;我有一个内容类型MyContentType,它包含一个文本列表、字段MyContentType下拉列表,当您转到www.mywebsite.web/node/123/confirmpage,一个featurename\u content\u类型而不是MyContentType的节点时,我希望显示字段MyContentType下拉列表。已解决:请参阅
<?php
/** featurename.module */
function featurename_confirm_page($form, &$form_state, $node) {
  $question = t('Are you sure you want to proceed with <em>@something</em> task?', array('@something' => $node->title));
  $form = array();
  $form['#node'] = $node;
  $form['nid'] = array(
    '#type' => 'value',
    '#value' => $node->nid,
  );
  $form = confirm_form($form, $question, 'node/' .
    $node->nid, t(  (preg_match("/featurename_content_type/i", $node->type) ? 'DROP-DOWN MENU HERE: ' .
    /* (insert list text field from another content type here) */ .
    : '') .
    '<p>By proceeding you are confirming that you want to do something; click only after you have selected an option from the drop-down menu and are ready to do something.'));
  return $form;
} // end featurename_confirm_page
?>