You are here

function _commerce_kickstart_setup_blocks in Commerce Kickstart 7.2

Configures the theme and assign blocks to the appropriate regions.

1 call to _commerce_kickstart_setup_blocks()
_commerce_kickstart_post_import in ./commerce_kickstart.install_callbacks.inc
BatchAPI callback.

File

./commerce_kickstart.install_callbacks.inc, line 279
Contains Batch API callbacks used during installation.

Code

function _commerce_kickstart_setup_blocks() {
  $admin_theme = variable_get('admin_theme', 'commerce_kickstart_admin');
  $default_theme = variable_get('theme_default', 'omega_kickstart');
  $blocks = array(
    array(
      'module' => 'system',
      'delta' => 'help',
      'theme' => $admin_theme,
      'status' => 1,
      'weight' => 0,
      'region' => 'help',
      'pages' => '',
      'cache' => DRUPAL_NO_CACHE,
    ),
    array(
      'module' => 'system',
      'delta' => 'help',
      'theme' => $default_theme,
      'status' => 1,
      'weight' => 0,
      'region' => 'preface_first',
      'pages' => '',
      'cache' => DRUPAL_NO_CACHE,
    ),
    array(
      'module' => 'system',
      'delta' => 'main',
      'theme' => $default_theme,
      'status' => 1,
      'weight' => 0,
      'region' => 'content',
      'pages' => '<front>',
      // Do not show the block on front.
      'visibility' => 0,
      'cache' => DRUPAL_NO_CACHE,
    ),
    // Connector.
    array(
      'module' => 'connector',
      'delta' => 'one_click_block',
      'theme' => $default_theme,
      'status' => 1,
      'weight' => 1,
      'region' => 'content',
      'pages' => "user\r\nuser/login",
      'visibility' => BLOCK_VISIBILITY_LISTED,
      'cache' => DRUPAL_NO_CACHE,
    ),
    // Search sorting.
    array(
      'module' => 'search_api_sorts',
      'delta' => 'search-sorts',
      'theme' => $default_theme,
      'status' => 1,
      'weight' => -30,
      'region' => 'content',
      'pages' => 'products',
      'visibility' => BLOCK_VISIBILITY_LISTED,
      'cache' => DRUPAL_NO_CACHE,
    ),
    // Commerce checkout progress
    array(
      'module' => 'commerce_checkout_progress',
      'delta' => 'indication',
      'theme' => $default_theme,
      'status' => 1,
      'weight' => -10,
      'region' => 'breadcrumb',
      'pages' => "checkout/*\ncart",
      'visibility' => BLOCK_VISIBILITY_LISTED,
      'cache' => DRUPAL_NO_CACHE,
      'title' => '<none>',
    ),
  );
  drupal_static_reset();
  _block_rehash($admin_theme);
  _block_rehash($default_theme);
  foreach ($blocks as $record) {
    $module = array_shift($record);
    $delta = array_shift($record);
    $theme = array_shift($record);
    db_update('block')
      ->fields($record)
      ->condition('module', $module)
      ->condition('delta', $delta)
      ->condition('theme', $theme)
      ->execute();
  }
}