commerce-8.x-2.8/modules/price/commerce_price.install
modules/price/commerce_price.install
<?php /** * @file * Contains install and update functions for Price. */ /** * Implements hook_requirements(). */ function commerce_price_requirements($phase) { $requirements = []; if ($phase == 'install') { if (!class_exists('\CommerceGuys\Intl\Currency\CurrencyRepository')) { $requirements['commerce_price_library'] = [ 'description' => t("Commerce Price requires the commerceguys/intl library."), 'severity' => REQUIREMENT_ERROR, ]; } } return $requirements; } /** * Implements hook_install(). */ function commerce_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('commerce_price.currency_importer'); $currency_importer->importByCountry($default_country); } }