forked from davpsh/commerce_yandex_checkout
-
Notifications
You must be signed in to change notification settings - Fork 1
/
yandex_checkout.module
48 lines (41 loc) · 964 Bytes
/
yandex_checkout.module
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
/**
* @file
* Provides module functions.
* @todo: ignore this phpcs rule.
*/
/**
* Implements hook_theme().
*/
function yandex_checkout_theme() {
return [
'payment_description_template_help' => [
'variables' => [
'description' => NULL,
],
],
];
}
/**
* Prepares variables for payment description template help text.
*
* Default template: payment-description-template-help.html.twig.
*
* @param array $variables
* An associative array containing:
* - description: The normal description payment template.
*/
function template_preprocess_payment_description_template_help(array &$variables) {
$descriptions = [];
$description = $variables['description'] ?? [];
if (!is_array($description)) {
$description = [$description];
}
foreach ($description as $value) {
if (empty($value)) {
continue;
}
$descriptions[] = $value;
}
$variables['descriptions'] = $descriptions;
}