
| Current Path : /var/www/html/store/web/modules/contrib/commerce/modules/price/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/store/web/modules/contrib/commerce/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' || $phase == 'runtime') {
if (!class_exists('\CommerceGuys\Intl\Currency\CurrencyRepository')) {
$requirements['commerce_price_intl'] = [
'title' => t('Intl 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);
}
}