0
有誰能告訴我爲什麼這樣不起作用嗎?Drupal 7 Hook_forms不能正常工作
drupal_render(drupal_get_form)是在foreach循環中動態創建的,並放入表格主題中。
除了表單域之外的所有東西都會加載。我試着通過在每個表單函數調用中添加回聲和退出來進行調試,但頁面會繼續加載。我不確定這些功能是否只是沒有被調用,或者是否有其他問題。
foreach($w as $k => $v) {
$r[] = array(
'$'.number_format($v->amount, 2),
date('F d, Y', $v->created),
filter_xss($v->paypal_email),
drupal_render(drupal_get_form(('toefl_tutors_admin_withdrawl_request_form_'.$v->id), $v->id))
);
}
function toefl_tutors_admin_withdrawl_request_forms($form_id, $args) {
$forms = array();
if (!empty($args) && $form_id == 'toefl_tutors_admin_withdrawl_request_form_' . $args[0]) {
$forms[$form_id] = array(
'callback' => 'toefl_tutors_admin_withdrawl_request_form',
'callback arguments' => array($args[0]),
);
}
return $forms;
}
function toefl_tutors_admin_withdrawl_request_form($form, &$form_state, $id = 0) {
$form['twid'] = array(
'#type' => 'hidden',
'#value' => $id
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Send Money'),
'#attributes' => array('class' => array('btn', 'btn-success'))
);
return $form;
}
哦。我也需要在更改名稱後清除緩存。 –