文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>[Drupal] Use administrative theme when deleting or reviewing the content node

[Drupal] Use administrative theme when deleting or reviewing the content node

时间:2010-09-15  来源:DavidHHuan

As we know, in drupal, the frontend and backend are mixed together, but when we click the button "delete" or "revisions" of a node, we are redirected to frontend, so how can we set to stay in backend when doing that?

 

Thanks to the implement of drupal, we can hook the hook_init() function to do that. Here is a way to build a module called "my_admin_node"

 

About how to build a module in drupal, please google it :)

 

In the my_admin_node.module file, we write the code as below for example:

代码
<?php
// $Id:


/**
* Implementation of hook_init().
*/
function my_admin_node_init() {
// Use the administrative theme
$arg_2 = arg(2);
if (
$arg_2 == 'delete'
|| $arg_2 == 'revisions'
|| (arg(0) == 'user' && !empty($arg_2))
) {
global $custom_theme;
$custom_theme = variable_get('admin_theme', '0');
drupal_add_css(drupal_get_path(
'module', 'system') .'/admin.css', 'module');
}
}
so when we visit node/111/delete, we will still stay in backend but not redirected to frontend.

 

Have fun with drupal!

相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载