Drupal 6 - 添加分类术语后重定向

标签 drupal drupal-6 drupal-modules drupal-taxonomy

在 Drupal 中添加分类术语时,它会重定向回自身以添加另一个术语。有没有办法覆盖这个?

到目前为止我已经尝试过:

• 将 ?destination=_ 添加到链接到/add/term/页面的页面
• 尝试过hook_taxonomy:

function modulename_taxonomy($op, $type, $array = NULL) {
  if ($type == 'term' && ($op == 'insert' || $op == 'update') && $array['parent'][39] == 39) {
    drupal_goto('page.html');
  }
}

如果我用 die('Here'); 代替 drupal_goto(),它就会输出,但是 drupal_goto() 不起作用?

最佳答案

实现hook_form_FORM_ID_alter以下方法之一。

  • 如果您事先知道要重定向到哪里,请更改 $form['#redirect']条目。
  • 如果您在提交后才知道要重定向到哪里,请向 $form['#submit'] 添加一个额外的回调。该回调接收 $form 数组和 &$form_state 数组引用。将 $form_state['redirect'] 条目设置为您要重定向到的路径。

关于Drupal 6 - 添加分类术语后重定向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5974773/

相关文章:

php - 如何在 drupal 主题中编辑 htm/css?

linux - 直接从 GitLab 私有(private)仓库打开文件

Drupal 网址编码

Drupal CCK 字段选择选项名称,它们在哪里?

html - Div 仅在 Firefox 中向右移动

drupal - 在 Bluemix 中的环境之间迁移 API Connect Developer Portal

php - 在 PHP Try Catch block 中抛出异常

drupal - 每次保存节点后如何在drupal中执行操作?

php - Drupal的模块钩子(Hook)调用从哪里开始?

drupal - 如何以编程方式在 Drupal 7 中注销用户?