如何将参数传递给 Drupal 中的表单提交处理程序
我正在开发一个对于多种表单来说很常见的模块。我需要将 $form_id 作为参数传递给提交处理程序,并在提交函数中相应地设置表单值。
function ppi_form_alter(&$form, &$form_state, $form_id){
$form['#submit'][]="action_form_submit";
}
function action_form_submit($form, &$form_state) {
//here I need to get the form_id of the form and form_set_value accordingly ... How can I know the form value?
}
有没有办法知道 form_submit 中的 form_id ?
谢谢!
I am working on a module which is common for a number of forms. I need to pass the $form_id as a parameter to the submit handler and set the form values accordingly in the submit function.
function ppi_form_alter(&$form, &$form_state, $form_id){
$form['#submit'][]="action_form_submit";
}
function action_form_submit($form, &$form_state) {
//here I need to get the form_id of the form and form_set_value accordingly ... How can I know the form value?
}
Is there a way to know the form_id in form_submit ?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在hook_form_alter()中将其设置为隐藏字段,
然后像使用提交处理程序中的任何其他字段一样使用它
Set it as a hidden field in the hook_form_alter(),
and then use it as you would any other field in the submit handler