zoukankan      html  css  js  c++  java
  • [Drupal] Using the admin theme when you deleting a node.

    As we know that, in Drupal, it does not separate the front-end and back-end. Though we can set the back-end theme, but some time, it still displays the front-end theme, for example, when deleting a node, it will display the front-end theme but not the back-end theme you wish to, here is a way to build a very simple module to do it.

    About the .info, please search the details in drupal.org, here i only provide the code of .module.

    Let say the module "my_admin_node" is what we will build. Here is the codes of my_admin_node.module

    代码
    /**
     * 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');
      }
    }

    yeah, you can see that is just a very simple module with a very simple way to do that,  and with this info, i hope you can build your own complex module. :)

    Have fun with Drupal! 

  • 相关阅读:
    http服务读取配置文件,交叉编译
    etcd增删改查
    初始
    20141017--类型String类
    20141017--异常语句try-catch
    20141017--循环语句whlie,do
    20141017--循环语句for 穷举
    20141016--for 菱形
    20141016--for 兔子
    20141015--for语句1
  • 原文地址:https://www.cnblogs.com/davidhhuan/p/1938522.html
Copyright © 2011-2022 走看看