Summary
If a theme exists at sites/*/mytheme/, install_default_theme('mytheme') and install_admin_theme('mytheme') work.
If a theme exists at profiles/myprofile/mytheme/, install_default_theme('mytheme') and install_admin_theme('mytheme') do not work.

As I'm sure you know, Drupal now automatically packages modules and themes that are required by installation profiles.

Drupal places required themes in profile/profilename/themes. The problem is that for some reason, the themes in this directory cannot be enabled with install_default_theme() and install_admin_theme(). When an install profile tries to do this, the user receives error messages from system.inc (which from my experience seems to indicate that the theme cannot be found). The user will then have a broken theme, but as soon as he visits admin/build/themes, the theme originally set with install_default_theme() and install_admin_theme() will become active.

On the other hand, if the theme exists in sites/*/themes before install_default_theme() and install_admin_theme() are called, the theme becomes active as expected.

Comments

john.karahalis’s picture

Correction: The errors relate to system.module, not system.inc.

Below is the actual error message that a user receives when a profile tries to use install_default_theme() and install_admin_theme() to enable a packaged theme. The actual messages are less-than-helpful, but as I said, I have seen them appear in the past when a profile was trying to enable a theme that Drupal couldn't find.

    * warning: array_map() [function.array-map]: Argument #2 should be an array in [...]/modules/system/system.module on line 1015.
    * warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in [...]/modules/system/system.module on line 1053.
    * warning: array_keys() [function.array-keys]: The first argument should be an array in [...]/modules/system/system.module on line 1030.
    * warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in [...]/modules/system/system.module on line 1053.
    * warning: array_keys() [function.array-keys]: The first argument should be an array in [...]/modules/system/system.module on line 1030.
    * warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in [...]/modules/system/system.module on line 1053.
    * warning: array_keys() [function.array-keys]: The first argument should be an array in [...]/modules/system/system.module on line 1030.
dww’s picture

Title: Can't enable themes packaged by Drupal.org » Can't enable themes during install that are in profile/[profile_name]/themes
Project: Install Profile API (obsolete) » Drupal core
Version: 6.x-2.1 » 6.x-dev
Component: CRUD functions and includes » install system
Status: Active » Closed (duplicate)