Skip to content

Instantly share code, notes, and snippets.

@manumilou
Last active August 29, 2015 14:08
Show Gist options
  • Save manumilou/77401cd842945a537f2c to your computer and use it in GitHub Desktop.
Save manumilou/77401cd842945a537f2c to your computer and use it in GitHub Desktop.
Set a default theme and an admin theme during profile installation
<?php
/**
* Implements hook_install().
*/
function my_custom_profile_install() {
// Here, the admin theme is adminimal, and the default theme is called bueno
// It seems like if the themes are not enabled in the database directly, just setting the default theme does not work.
// Enable the admin theme.
db_update('system')->fields(array('status' => 1))->condition('type', 'theme')->condition('name', 'adminimal')->execute();
// Enable Bueno
db_update('system')->fields(array('status' => 1))->condition('type', 'theme')->condition('name', 'bueno')->execute();
theme_disable(array('bartik'));
// Set the admin theme and enable it
variable_set('admin_theme', 'adminimal');
variable_set('node_admin_theme', '1');
// Set the default theme
variable_set('theme_default', 'bueno');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment