-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathhelfi_node_page.module
115 lines (109 loc) · 2.71 KB
/
helfi_node_page.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<?php
/**
* @file
* Contains hooks for 'helfi_node_page' module.
*/
declare(strict_types=1);
use Drupal\helfi_platform_config\DTO\ParagraphTypeCollection;
/**
* Implements hook_platform_config_grant_permissions().
*/
function helfi_node_page_platform_config_grant_permissions() : array {
return [
'admin' => [
'create page content',
'delete any page content',
'delete own page content',
'delete page revisions',
'edit any page content',
'edit own page content',
'revert page revisions',
'set page published on date',
'translate page node',
'view page revisions',
],
'content_producer' => [
'create page content',
'delete own page content',
'edit any page content',
'edit own page content',
'revert page revisions',
'set page published on date',
'translate page node',
'view any unpublished page content',
'view page revisions',
],
'editor' => [
'create page content',
'delete any page content',
'delete own page content',
'delete page revisions',
'edit any page content',
'edit own page content',
'revert page revisions',
'set page published on date',
'translate page node',
'view page revisions',
],
'read_only' => [
'view any unpublished page content',
],
];
}
/**
* Implements hook_helfi_paragraph_types().
*/
function helfi_node_page_helfi_paragraph_types() : array {
$types = [
'field_hero' => [
'hero' => 0,
],
'field_content' => [
'text' => 0,
'accordion' => 1,
'banner' => 2,
'image' => 3,
'list_of_links' => 4,
'content_cards' => 5,
'columns' => 6,
'phasing' => 7,
'from_library' => 8,
'map' => 9,
'remote_video' => 10,
'chart' => 11,
'event_list' => 13,
'contact_card_listing' => 14,
'news_list' => 15,
'image_gallery' => 16,
],
'field_lower_content' => [
'list_of_links' => 0,
'content_cards' => 1,
'text' => 2,
'accordion' => 3,
'banner' => 4,
'image' => 5,
'columns' => 6,
'phasing' => 7,
'from_library' => 8,
'map' => 9,
'remote_video' => 10,
'chart' => 11,
'event_list' => 13,
'contact_card_listing' => 14,
'news_list' => 15,
'image_gallery' => 16,
],
'field_sidebar_content' => [
'from_library' => 0,
'sidebar_text' => 1,
],
];
$enabled = [];
foreach ($types as $field => $paragraphTypes) {
foreach ($paragraphTypes as $paragraphType => $weight) {
$enabled[] = new ParagraphTypeCollection('node', 'page', $field, $paragraphType, $weight);
}
}
return $enabled;
}