1

I'm trying to use this snippet I found, but it throws this error:

function mytheme_init() {
  // Hardcode the administration theme onto the blocks page
  if ($_GET['q'] == 'admin/build/block') {
    global $theme;
    $theme = 'rubik';
  }
}

Fatal error: Unsupported operand types in /var/www/clients/client4/web39/web/modules/block/block.admin.inc on line 39

The $theme = 'rubik'; line appears to be the culprit in some way, as it doesn't throw the error if I comment it.

2 Answers 2

3

You have to use the global variable $custom_theme.
The implementation of your hook_init() is good.

2

There is a good module for this: Administration theme.

Drupal allows you to define a different theme for administration pages (Administer -> Site configuration -> Administration theme). By default this only applies to pages with a path starting with 'admin' and content editing pages.
The Administration theme module allows you to use this theme on more pages like:

  • batch processing pages
  • devel node load and render pages
  • coder code review pages
  • pages you define yourself in the provided textarea

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.