You are here

function commons_install in Drupal Commons 7.3

Implements hook_install().

File

./commons.install, line 497
Install, update and uninstall functions for the Commons install profile.

Code

function commons_install() {

  // Enable the Origins theme and set it as the default.
  theme_enable(array(
    'commons_origins',
  ));

  // The Bartik theme is automatically enabled during installation. Disable it.
  db_update('system')
    ->fields(array(
    'status' => 0,
  ))
    ->condition('type', 'theme')
    ->condition('name', 'bartik')
    ->execute();

  // Set Commons Origins as the default theme.
  variable_set('theme_default', 'commons_origins');

  // Set Ember as the administration theme.
  variable_set('admin_theme', 'ember');

  // Do not use the administration theme when editing or creating content.
  variable_set('node_admin_theme', FALSE);

  // Set jQuery version to 1.7
  variable_set('jquery_update_jquery_version', '1.7');

  // Set a default user avatar.
  commons_set_default_avatar();

  // Place site blocks in the menu_bar and header regions.
  $menu_block = array(
    'module' => 'system',
    'delta' => 'main-menu',
    'theme' => 'commons_origins',
    'visibility' => 0,
    'region' => 'menu_bar',
    'status' => 1,
    'pages' => '',
    'title' => '<none>',
  );
  drupal_write_record('block', $menu_block);
  $search_block = array(
    'module' => 'search',
    'delta' => 'form',
    'theme' => 'commons_origins',
    'visibility' => 0,
    'region' => 'header',
    'status' => 1,
    'pages' => '',
    'weight' => 2,
    'title' => '<none>',
  );
  drupal_write_record('block', $search_block);

  // AdaptiveTheme requires that the system theme settings form
  // be submitted in order for its themes' settings to be properly set
  // and the resulting css files generated.
  // For more background, see http://drupal.org/node/1776730.
  module_load_include('inc', 'system', 'system.admin');
  $form_state = form_state_defaults();
  $form_state['build_info']['args'][0] = 'commons_origins';
  $form_state['values'] = array();
  drupal_form_submit('system_theme_settings', $form_state);
}