1

One of the great things about Drupal 7 is the inclusion of an administration theme, Seven.

How does Drupal determine whether to display the administration theme or the site's theme?
Is it path-based (everything under /admin), or something else?

4

There is now a hook for this: hook_admin_paths(). As usual, the default configuration is in system_admin_paths() but there are many other implementations in core, search for _admin_paths.

1
  • Oh that is awesome: if Drupal 6's motto was "there's a module for that", Drupal 7's should be "there's a hook for that". I was also interested in how I could check if the page I'm on is an admin path, but using your info I was able to find it: path_is_admin()
    – user7
    Mar 7 '11 at 21:47
1

Here is an example for using hook_admin_paths to display the advance help + user login pages in the admin theme.

/**
 * Implement hook_admin_paths(), 
 * to define which paths will be displayed in the admin theme.
 */
function objet_admin_paths() {
  $paths = array(
    'help*' => TRUE, // the advanced help module
    'user*' => TRUE, // User login screens
  );

  return $paths;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy