You are here

price.module in Price 8

Same filename and directory in other branches
  1. 3.x price.module
  2. 2.0.x price.module
  3. 2.x price.module
  4. 3.0.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().