【发布时间】:2023-03-26 11:35:01
【问题描述】:
我想在提交后重定向我的表单,我正在尝试使用钩子,但这就是我得到的:
function node_form_submit(&$form, $form_state) {
$form_state['redirect'] = 'contentManager/';
}
致命错误:无法重新声明 node_form_submit() (以前 宣布于 drupal/modules/node/node.pages.inc:451) 在 drupal/sites/all/themes/bluemarine/template.php 第 31 行
我正在为我的钩子使用模块名称“node”。我想这是错误的,但我不明白为什么
更新: 好的,我不是在开发新模块。我已将该函数添加到 Bluemarine 模板中的 template.php。
function bluemarine_form_alter(&$form, $form_state) {
$form_state['redirect'] = 'contentManager/';
}
Bluemarine 是我的主题名称。“contentManager”是我在后端创建的页面,其中包含所有节点的视图。
这个函数完全被忽略了。
更新2 好的,现在,这是我当前的 template.php 文件(我确定调用了 phptemplate_node_form)
function phptemplate_node_form($form) {
$form['#submit'][] = 'myFormSubmit';
}
function myFormSubmit() {
echo "hello";
die();
}
函数 myFormSubmit 未被调用。
谢谢
【问题讨论】: