You are here

price.module in Price 3.0.x

Same filename and directory in other branches
  1. 8 price.module
  2. 3.x price.module
  3. 2.0.x price.module
  4. 2.x price.module

Defines the Currency entity and the Price field.

File

price.module
View 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

Namesort descending Description
price_configurable_language_insert Implements hook_ENTITY_TYPE_insert() for 'configurable_language'.
price_theme Implements hook_theme().