[Drupal] Submit and redirect back to the modify page
First you have to create a new module called "my_submit", and in the my_submit.module, insert the code as below:
// $Id:
/******************************** READ ME **********************
*
*
No addons required. Drop the entire submit again folder in your modules directory,
usually sites/all/modules on your Drupal filesystem, activate it on the modules
page, and turn it on for each content type it should be attached to at
Administer -> Content management -> Content types -> (edit each content type)
*
*
*************************Create by DavidHHuan*******************/
/**
* @file
* Add a new button to node creation forms that
* allows the content author to return to the node
* creation form after saving new content instead
* of going to the view page of the new content.
*/
/**
* Implementation of hook_form_alter().
*/
function my_submit_form_alter(&$form, $form_state, $form_id) {
if (strpos($form_id, '_node_form') && !isset($form['nid']['#value'])) {
if (variable_get('my_submit_'. $form['type']['#value'], FALSE)) {
$form['buttons']['my_submit'] = array(
'#type' => 'submit',
'#value' => t('Save and review'),
'#weight' => 41,
'#submit' => array('node_form_submit', 'my_submit_node_form_submit'),
);
}
}
}
function my_submit_node_form_submit($form, &$form_state) {
//Go back to the content edit page which is created just now.
$form_state['redirect'] .= '/edit';
}
/**
* Alter content type settings to add "Submit Again?" checkbox
*/
function my_submit_form_node_type_form_alter(&$form, &$form_state) {
if (isset($form['identity']['type'])) {
$form['submission']['my_submit'] = array(
'#type' => 'checkbox',
'#title' => t('Submit and review?'),
'#default_value' => variable_get('my_submit_'. $form['#node_type']->type, FALSE),
'#description' => t('Enable this checkbox if you want to provide a "Save and review" button for your users.')
);
}
}
I have added readMe in the code comment.
转载于:https://www.cnblogs.com/davidhhuan/archive/2010/09/08/1821258.html
[Drupal] Submit and redirect back to the modify page相关推荐
- Magento : Make 'Continue Shopping' button redirect to the product index page
Magento : Make 'Continue Shopping' button redirect to the last-added-to-cart product's category Edit ...
- c:redirect标签的使用
<c:redirect>标签的使用代码例子 redirect.jsp <%@ page contentType="text/html" pageEncoding= ...
- 如何重定向到另一个网页? [英]How do I redirect to another webpage?
How can I redirect the user from one page to another using jQuery or pure JavaScript? 如何使用jQuery或纯Ja ...
- java servlet_Java Servlet的前100个问题
java servlet 1)是" servlets"目录还是" servlet"目录? 回答: 对于Java Web Server: 在文件系统上,它是&qu ...
- Java Servlet的前100个问题
1)是" servlets"目录还是" servlet"目录? 回答: 对于Java Web Server: 在文件系统上,它是" servlet&q ...
- 注解形式控制器配置(2)
6.5.请求映射 处理器定义好了,那接下来我们应该定义功能处理方法,接收用户请求处理并选择视图进行渲染.首先我们看一下图6-1: http请求信息包含六部分信息: ①请求方法,如GET或POST,表示 ...
- js 幻灯片放映图片_如何制作数据库驱动的首页幻灯片放映
js 幻灯片放映图片 It is becoming increasingly popular to have a front-page slider on a web site. Nearly eve ...
- javaweb常识类英语
browser ['braʊzə] n. [计] 浏览器:吃嫩叶的动物:浏览书本的人 web [web] n. 网:卷筒纸:蹼:织物:圈套; vt. 用网缠住:使中圈套; vi. 形成网 hypert ...
- ebay api_引入eBay交易API-设置
ebay api In this tutorial series, I'll walk you through Ebay's Trading API. The Trading API allows y ...
最新文章
- python答辩结束语_2018-08-17 结束答辩
- 【数据挖掘笔记五】数据立方体技术
- 设备怎样开启位置服务器,开启设备服务器
- 计算机网络——第二次实验——思科模拟器组网实验
- java 蓝桥杯算法训练 快速排序
- EC600 QuecPython开发环境搭建、固件下载,最方便的OpenCPU物联网4G通信解决方案
- Ubuntu 在线升级linux 内核的方法
- each iteration和 each occurrunce的区别
- 开运算和闭运算的性质
- 计算机颜色的概念,颜色空间
- 神经网络模型怎么建立,如何选择神经网络模型
- 安全测试——SQL注入
- 如何在 vuepress 中添加博客导流公众号-即输入验证码解锁全站文章
- 高德地图自定义绘制园区区域,区域描边,并添加自定义内容maker标注
- 搭讪培训班 - 名品试用 - YOKA时尚论坛 - YOKA社区
- webuploader怎样上传文件夹
- 电影数据分析——国产烂片深度揭秘
- 基于深度学习的人脸识别与管理系统(UI界面增强版,Python代码)
- C语言 | 栈区空间初探
- oracle lms进程 内存,基于oracle 10.2.0.1 rac学习lms进程系列四
热门文章
- mysql 导出 没有函数_没有MYSQL FILE函数的CSV导出
- 多任务 schedule python_Python3.6 Schedule 模块定时任务 (实例讲解)
- Java ObjectOutputStream flush()方法与示例
- Anaconda自带Python编译器Jupyter Notebook显示代码行数
- web安全-----CSRF漏洞
- Linux网站大杂烩《自己查阅》
- [Linux]NAT和代理服务器
- 穿越火线全部服务器都显示爆满,穿越火线大区全部爆满,频道挤不进去背后的故事!...
- 用前序中序创建二叉树(用中序后序创建二叉树)
- Linux命令【二】终端+Vim