/[drupal]/contributions/modules/admin_theme/admin_theme.module
ViewVC logotype

Contents of /contributions/modules/admin_theme/admin_theme.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.4 - (show annotations) (download) (as text)
Tue Dec 2 21:52:56 2008 UTC (11 months, 3 weeks ago) by davyvandenbremt
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +1 -1 lines
File MIME type: text/x-php
no message
1 <?php
2 // $Id: admin_theme.module,v 1.3 2008/11/16 02:54:49 davyvandenbremt Exp $
3
4 /**
5 * @file
6 * Enable the administration theme on more pages then possible with Drupal's default administration page.
7 */
8
9 /**
10 * Implementation of hook_form_alter().
11 */
12 function admin_theme_form_system_admin_theme_settings_alter(&$form, $form_state) {
13 // we want our checkbox before the submit button
14 $form['buttons']['#weight'] = 6;
15
16 // batch processing page
17 $form['admin_theme_batch'] = array(
18 '#type' => 'checkbox',
19 '#weight' => 1,
20 '#title' => t('Use administration theme for batch processing'),
21 '#description' => t('Use the administration theme when executing batch operations.'),
22 '#default_value' => variable_get('admin_theme_batch', '0'),
23 );
24
25 // code reviews pages
26 if (module_exists('coder')) {
27 $form['admin_theme_coder'] = array(
28 '#type' => 'checkbox',
29 '#weight' => 2,
30 '#title' => t('Use administration theme for code reviews'),
31 '#description' => t('Use the administration theme when viewing Coder code reviews.'),
32 '#default_value' => variable_get('admin_theme_coder', '0'),
33 );
34 }
35
36 // code reviews pages
37 if (module_exists('devel')) {
38 $form['admin_theme_devel'] = array(
39 '#type' => 'checkbox',
40 '#weight' => 3,
41 '#title' => t('Use administration theme for devel node render and load pages'),
42 '#description' => t('Use the administration theme when viewing the Devel render and load tabs on nodes.'),
43 '#default_value' => variable_get('admin_theme_devel', '0'),
44 );
45 }
46
47 // service attachments form on nodes
48 if (module_exists('service_attachments')) {
49 $form['admin_service_attachments'] = array(
50 '#type' => 'checkbox',
51 '#weight' => 4,
52 '#title' => t('Use administration theme for viewing the service attachments form on nodes.'),
53 '#description' => t('Use the administration theme when viewing service attachments on nodes.'),
54 '#default_value' => variable_get('admin_service_attachments', '0'),
55 );
56 }
57
58 // define a custom list of pages
59 $form['admin_theme_path'] = array(
60 '#type' => 'textarea',
61 '#title' => t('Use administration theme on the following pages.'),
62 '#description' => t("Enter one page per line as Drupal paths. The '*' character is a wildcard. Example paths are %blog for the blog page and %blog-wildcard for every personal blog. %front is the front page.", array('%blog' => 'blog', '%blog-wildcard' => 'blog/*', '%front' => '<front>')),
63 '#weight' => 5,
64 '#default_value' => variable_get('admin_theme_path', ''),
65 );
66 }
67
68 /**
69 * Implementation of hook_init().
70 */
71 function admin_theme_init() {
72 $admin_theme = FALSE;
73
74 // batch processing page should get admin theme
75 if (variable_get('admin_theme_batch', '1') && arg(0) == 'batch') {
76 $admin_theme = TRUE;
77 }
78
79 // code reviews pages should get admin theme
80 if (module_exists('coder') && variable_get('admin_theme_coder', '1') && arg(0) == 'coder') {
81 $admin_theme = TRUE;
82 }
83
84 // code reviews pages should get admin theme
85 if (module_exists('devel') && variable_get('admin_theme_devel', '1') && arg(0) == 'node' && is_numeric(arg(1)) && arg(2) == 'devel' && (arg(3) == 'load' || arg(3) == 'render')) {
86 $admin_theme = TRUE;
87 }
88
89 // service attachments form on nodes should get admin theme
90 if (module_exists('service_attachments') && variable_get('admin_service_attachments', '1') && arg(0) == 'node' && arg(2) == 'service_attachments') {
91 $admin_theme = TRUE;
92 }
93
94 // some custom defined pages should get admin theme
95 if (trim(variable_get('admin_theme_path', '')) != '') {
96 // pages that are defined by their normal path
97 $match_path = drupal_match_path($_GET['q'], variable_get('admin_theme_path', ''));
98
99 // pages that are defined with their alias
100 $alias = drupal_get_path_alias($_GET['q']);
101 if ($alias != $_GET['q']) {
102 $match_alias = drupal_match_path($alias, variable_get('admin_theme_path', ''));
103 }
104
105 $admin_theme = $match_path || $match_alias;
106 }
107
108 // Use the admin theme for the current request (if global admin theme setting is checked).
109 if ($admin_theme) {
110 global $custom_theme;
111 $custom_theme = variable_get('admin_theme', '0');
112 }
113 }

  ViewVC Help
Powered by ViewVC 1.1.2