price.module in Price 8
Same filename and directory in other branches
Defines the Currency entity and the Price field.
File
price.moduleView source
<?php
/**
* @file
* Defines the Currency entity and the Price field.
*/
use Drupal\language\Entity\ConfigurableLanguage;
/**
* Implements hook_theme().
*/
function price_theme() {
return [
'price_plain' => [
'variables' => [
'number' => 0,
'currency' => NULL,
],
'template' => 'price-plain',
],
];
}
/**
* Implements hook_ENTITY_TYPE_insert() for 'configurable_language'.
*/
function price_configurable_language_insert(ConfigurableLanguage $language) {
if (!\Drupal::isConfigSyncing()) {
// Import currency translations for the new language.
$importer = \Drupal::service('price.currency_importer');
$importer
->importTranslations([
$language
->getId(),
]);
}
}
Functions
Name | Description |
---|---|
price_configurable_language_insert | Implements hook_ENTITY_TYPE_insert() for 'configurable_language'. |
price_theme | Implements hook_theme(). |