You are here

function bear_necessities_install in Bear 7

Same name and namespace in other branches
  1. 7.2 modules/bear_necessities/bear_necessities.install \bear_necessities_install()

Implements hook_install().

File

modules/bear_necessities/bear_necessities.install, line 11
Install, update and uninstall functions for bear_necessities module.

Code

function bear_necessities_install() {
  db_update('system')
    ->fields(array(
    'weight' => 100,
  ))
    ->condition('name', 'bear_necessities')
    ->execute();

  // Set default date formats to American style
  variable_set("date_format_long", "l, F j, Y - g:ia");
  variable_set("date_format_medium", "F j, Y - g:ia");
  variable_set("date_format_short", "m/d/Y - g:ia");

  // Add a Home link to the main menu.
  $item = array(
    'link_path' => '<front>',
    'link_title' => 'Home',
    'menu_name' => 'main-menu',
  );
  menu_link_save($item);

  // Add database entry for our custom menu block.
  // This is a bit hacky since block module will do this anyway
  // but for now it's the best way to set the region on install.
  $block = array(
    'module' => 'menu_block',
    'delta' => 'bear_necessities-1',
    'theme' => 'bear_coat',
    'region' => 'navigation',
    'status' => 1,
    'pages' => '',
  );
  drupal_write_record('block', $block);
}