You are here

function hostmaster_setup_theme in Hostmaster (Aegir) 5.x

Enable a theme, if present

Parameters

mixed The theme name or an array of preferred themes, that: will be tried in order.

1 call to hostmaster_setup_theme()
hostmaster_profile_final in ./hostmaster.profile
Perform any final installation tasks for this profile.

File

./hostmaster.profile, line 323

Code

function hostmaster_setup_theme($name) {
  if (!is_array($name)) {
    $name = array(
      $name,
    );
  }
  $themes = system_theme_data();

  // In preference descending order
  foreach ($name as $theme) {
    if (array_key_exists($theme, $themes)) {
      system_initialize_theme_blocks($theme);
      db_query("UPDATE {system} SET status = 1 WHERE type = 'theme' and name = '%theme'", array(
        '%theme' => $theme,
      ));
      variable_set('theme_default', $theme);
    }
  }
}