You are here

function commerce_demo_modules_installed in Commerce Demo 8

Same name and namespace in other branches
  1. 8.2 commerce_demo.module \commerce_demo_modules_installed()

Implements hook_modules_installed().

File

./commerce_demo.module, line 73
Provides a demo store for Commerce.

Code

function commerce_demo_modules_installed($modules) {
  if (in_array('commerce_demo', $modules)) {
    $index_storage = \Drupal::entityTypeManager()
      ->getStorage('search_api_index');

    /** @var \Drupal\search_api\IndexInterface $index */
    $index = $index_storage
      ->load('products');
    $index
      ->indexItems();
    $theme_handler = \Drupal::getContainer()
      ->get('commerce_demo.theme_handler');
    $default_theme = \Drupal::config('system.theme')
      ->get('default');
    $theme_handler
      ->placeBlocks($default_theme);
  }
}