You are here

function price_install in Price 2.x

Same name and namespace in other branches
  1. 2.0.x price.install \price_install()

Implements hook_install().

File

./price.install, line 29
Contains install and update functions for Price.

Code

function price_install() {
  if (!\Drupal::isConfigSyncing()) {

    // Import a currency to speed up initial store setup.
    // If no default country is set, import the US Dollar, since it's common.
    $default_country = \Drupal::config('system.date')
      ->get('country.default');
    $default_country = $default_country ?: 'US';
    $currency_importer = \Drupal::service('price.currency_importer');
    $currency_importer
      ->importByCountry($default_country);
  }
}