我可以使用不同的钩子来获取提交的新节点的node_id吗?
function dc_project_management_form_bug_request_node_form_alter(&$form, &$form_state, $form_id)
{
$form['#submit'][] = 'dc_project_management_process_bug_request_milestone_submit';
}
function dc_project_management_process_bug_request_milestone_submit($form, &$form_state)
{
//NULL when submitting new node
$form_state['values']['nid'];
}
答案 0 :(得分:5)
此时节点尚未实际保存,您需要实现hook_node_insert
:
function dc_project_management_node_insert($node) {
$nid = $node->nid;
}