-
Notifications
You must be signed in to change notification settings - Fork 0
/
donation.module
55 lines (49 loc) · 1.45 KB
/
donation.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
49
50
51
52
53
54
55
<?php
/**
* @file
* Contains donation.module.
*/
/**
* Implements hook_theme().
*/
function donation_theme() {
$theme = [];
$theme['donation'] = [
'render element' => 'elements',
'file' => 'donation.page.inc',
'template' => 'donation',
];
$theme['donation_content_add_list'] = [
'render element' => 'content',
'variables' => ['content' => NULL],
'file' => 'donation.page.inc',
];
return $theme;
}
/**
* Implements hook_theme_suggestions_HOOK().
*/
function donation_theme_suggestions_donation(array $variables) {
$suggestions = [];
$entity = $variables['elements']['#donation'];
$sanitized_view_mode = strtr($variables['elements']['#view_mode'], '.', '_');
$suggestions[] = 'donation__' . $sanitized_view_mode;
$suggestions[] = 'donation__' . $entity->bundle();
$suggestions[] = 'donation__' . $entity->bundle() . '__' . $sanitized_view_mode;
$suggestions[] = 'donation__' . $entity->id();
$suggestions[] = 'donation__' . $entity->id() . '__' . $sanitized_view_mode;
return $suggestions;
}
/**
* Implements hook_entity_base_field_info_alter().
*/
function donation_entity_base_field_info_alter(&$fields, $entity_type) {
// By default email address field of user entity is hidden in 'Manage display"
// tab.
if ($entity_type->id() == 'user') {
if (isset($fields['mail'])) {
$fields['mail']->setDisplayConfigurable('view', TRUE);
$fields['mail']->setDisplayConfigurable('form', TRUE);
}
}
}