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
Searched words:
use admin theme for help pages drupal
template.php switch themes
administration theming of help page
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.)
More like this
- Remove the main content title from the front page of the site
- Clean up and rationalize Drupal core Taxonomy Term Add and Edit form
- Check for duplicate titles of a node with AJAX to warn immediately before entering more data or submitting
- Installing Drush
- Add a subsection class to Drupal page body for theming Views and other parts of a site that can be defined by parts of the path


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