Home ›
Use the admin theme for Drupal help pagesUse the admin theme for Drupal help pages
Submitted by Benjamin Melançon on August 29, 2010 - 10:07am
This code goes in a module (not in template.php).
<?php
/**
* Implements hook_init().
*
* Set help pages to the admin theme.
*/
function examplecustommodule_init() {
if ($admin_theme = variable_get('admin_theme', 0)) {
if (arg(0) == 'help') {
global $custom_theme;
$custom_theme = $admin_theme;
// Appears to be unnecessary: init_theme();
}
}
}
?>
We change "examplecustommodule" to the name of our own module.
(This doesn't have to be a custom module... could be a proper contrib module. Actually should be a patch to the administration theme functionality in Drupal core.)
Searched words:
use admin theme for help pages drupal
template.php switch themes
administration theming of help page
Comments
Add admin.css
Thanks for the snippet. When you look at system.module, you see that admin.css is added after switching to the admin theme. It seems logical to do that in your custom module as well:
<?php
/**
* Implements hook_init().
*
* Set help pages to the admin theme.
*/
function examplecustommodule_init() {
if ($admin_theme = variable_get('admin_theme', 0)) {
if (arg(0) == 'help') {
global $custom_theme;
$custom_theme = $admin_theme;
drupal_add_css(drupal_get_path('module', 'system') .'/admin.css', 'module');
}
}
}
?>
Work fine !
Thanks a lot, work fine with drupal 7 !
Post new comment