You are here

commerce_kickstart_block.install in Commerce Kickstart 7.2

Performs some additional configuration when installing/enabling the module.

File

modules/commerce_kickstart/commerce_kickstart_block/commerce_kickstart_block.install
View source
<?php

/**
 * @file
 * Performs some additional configuration when installing/enabling the module.
 */

/**
 * Implements hook_enable().
 */
function commerce_kickstart_block_enable() {
  commerce_kickstart_rebuild_feature('commerce_kickstart_block');
  $default_theme = variable_get('theme_default', 'omega_kickstart');

  // Make sure that the region list is populated for our theme.
  drupal_static_reset();
  _block_rehash($default_theme);
  $admin_theme = variable_get('admin_theme', 'commerce_kickstart_admin');
  _block_rehash($admin_theme);

  // Footer navigation.
  db_update('block')
    ->fields(array(
    'region' => 'footer_first',
    'status' => (int) '1',
    'title' => '<none>',
  ))
    ->condition('module', 'menu')
    ->condition('delta', 'menu-footer-navigation')
    ->condition('theme', $default_theme)
    ->execute();

  // Payment-methods menu block.
  $fields = array(
    'region' => 'footer2_second',
    'status' => 1,
    'visibility' => 0,
    'pages' => '',
  );
  db_update('block')
    ->fields($fields)
    ->condition('module', 'menu')
    ->condition('delta', 'menu-payment-methods')
    ->condition('theme', $default_theme)
    ->execute();
  if (variable_get('commerce_kickstart_demo_store', FALSE)) {

    // Promotional banner block.
    db_update('block')
      ->fields(array(
      'region' => 'content',
      'status' => '1',
      'visibility' => '1',
      'pages' => 'node',
      'weight' => -9,
    ))
      ->condition('module', 'commerce_kickstart_block')
      ->condition('delta', 'promotional_banner')
      ->condition('theme', $default_theme)
      ->execute();

    // Shipping discount block.
    db_update('block')
      ->fields(array(
      'region' => 'content',
      'status' => '1',
      'visibility' => '1',
      'pages' => 'node',
      'weight' => 1,
    ))
      ->condition('module', 'commerce_kickstart_block')
      ->condition('delta', 'shipping_discount')
      ->condition('theme', $default_theme)
      ->execute();
  }

  // Powered by Drupal Commerce block.
  db_update('block')
    ->fields(array(
    'region' => 'footer2_first',
    'status' => '1',
    'visibility' => '0',
    'pages' => '',
    'weight' => -30,
  ))
    ->condition('module', 'commerce_kickstart_block')
    ->condition('delta', 'powered_drupal_commerce')
    ->condition('theme', $default_theme)
    ->execute();

  // Powered by Drupal Commerce block for admin.
  db_update('block')
    ->fields(array(
    'region' => 'footer',
    'status' => '1',
    'visibility' => '0',
    'pages' => '',
    'weight' => -30,
  ))
    ->condition('module', 'commerce_kickstart_block')
    ->condition('delta', 'powered_drupal_commerce')
    ->condition('theme', $admin_theme)
    ->execute();

  // Proudly built by CG block.
  db_update('block')
    ->fields(array(
    'region' => 'footer',
    'status' => '1',
    'visibility' => '0',
    'pages' => '',
    'weight' => -31,
  ))
    ->condition('module', 'commerce_kickstart_block')
    ->condition('delta', 'proudly_built_by_cg')
    ->condition('theme', $admin_theme)
    ->execute();
}

Functions