-
Notifications
You must be signed in to change notification settings - Fork 0
/
worksheet-custom-metabox.php
194 lines (154 loc) · 6.04 KB
/
worksheet-custom-metabox.php
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
<?php
/**
* h5p exercises integration
*
* This file is responsible for generating all the required elements with h5p exercises integration
*
*
* @link worksheed.books4languages.com
*
* @package extensions-for-pressbooks/efpb-h5p
* @since xxxx
*/
// defined ("ABSPATH") or die ("Action denied!");
// /**
// * Create the metabox 'h5p' for Chapter
// *
// * @since X.0
// */
add_action( 'custom_metadata_manager_init_metadata', 'x_init_custom_fields' );
function x_init_custom_fields() {
// adds a new group to the test post type
x_add_metadata_group( 'worksheet_exercises_meta_box', 'post', array(
'label' => 'Exercises'
) );
// adds a number field in the first group (with no min/max)
x_add_metadata_field( 'worksheet_topic_watu_id_field', 'post', array(
'group' => 'worksheet_exercises_meta_box',
'field_type' => 'number',
'label' => 'Topic examination ID',
'description' => 'This field It\'s the id of the watu exercise.', // description for the field
'required_cap' => 'remove_users',
) );
// h5p id
x_add_metadata_field( 'worksheet_book_h5p_id_field', 'post', array(
'group' => 'worksheet_exercises_meta_box',
'field_type' => 'number',
'label' => 'H5p Book Exercise ID',
'description' => 'This field It\'s the id of the h5p exercise at Book.', // description for the field
'required_cap' => 'remove_users',
) );
}
// /**
// * Create the metabox for links
// *
// * @since X.0
// */
add_action( 'custom_metadata_manager_init_metadata', 'x_init_custom_fields2' );
function x_init_custom_fields2() {
// adds a new group to the test post type
x_add_metadata_group( 'worksheet_url_meta_box', 'post', array(
'label' => 'External links'
) );
x_add_metadata_field( 'worksheet_topic_url_field', 'post', array(
'group' => 'worksheet_url_meta_box',
'field_type' => 'text',
'label' => 'Source book url',
'description' => 'This field is the url to the source page of the book.', // description for the field
'required_cap' => 'remove_users',
) );
}
// /**
// * Create the metabox 'h5p' for Activities
// *
// * @since X.0
// */
add_action( 'custom_metadata_manager_init_metadata', 'x_init_custom_fields3' );
function x_init_custom_fields3() {
// adds a new group to the test post type
x_add_metadata_group( 'worksheet_activities_meta_box', 'post', array(
'label' => 'Activities'
) );
// h5p id
// adds a number field in the first group (with no min/max)
x_add_metadata_field( 'worksheet_speaking_h5p_id_field', 'post', array(
'group' => 'worksheet_activities_meta_box',
'field_type' => 'number',
'label' => 'H5P Speaking activity ID',
'description' => 'This field It\'s the id of the Speaking activity.', // description for the field
'required_cap' => 'remove_users',
) );
// h5p id
// adds a number field in the first group (with no min/max)
x_add_metadata_field( 'worksheet_writing_h5p_id_field', 'post', array(
'group' => 'worksheet_activities_meta_box',
'field_type' => 'number',
'label' => 'H5P Writing activity ID',
'description' => 'This field It\'s the id of the Writing activity.', // description for the field
'required_cap' => 'remove_users',
) );
// h5p id
// adds a number field in the first group (with no min/max)
x_add_metadata_field( 'worksheet_reading_h5p_id_field', 'post', array(
'group' => 'worksheet_activities_meta_box',
'field_type' => 'number',
'label' => 'H5P Reading activity ID',
'description' => 'This field It\'s the id of the Reading activity.', // description for the field
'required_cap' => 'remove_users',
) );
// h5p id
// adds a number field in the first group (with no min/max)
x_add_metadata_field( 'worksheet_listening_h5p_id_field', 'post', array(
'group' => 'worksheet_activities_meta_box',
'field_type' => 'number',
'label' => 'H5P Listening activity ID',
'description' => 'This field It\'s the id of the Listening activity.', // description for the field
'required_cap' => 'remove_users',
) );
}
// /**
// * Create the metabox 'h5p' for Activities
// *
// * @since X.0
// */
add_action( 'custom_metadata_manager_init_metadata', 'x_init_custom_fields4' );
function x_init_custom_fields4() {
// adds a new group to the test post type
x_add_metadata_group( 'worksheet_extended_exercises_meta_box', 'post', array(
'label' => 'Extended exercises'
) );
x_add_metadata_field( 'worksheet_audio_recorder_h5p_id_field', 'post', array(
'group' => 'worksheet_extended_exercises_meta_box',
'field_type' => 'checkbox',
'label' => 'Activate Audio Recorder',
'description' => 'This field activate the students Audio recoreder in the topic.', // description for the field
'required_cap' => 'remove_users',
) );
// h5p id
// adds a number field in the first group (with no min/max)
x_add_metadata_field( 'worksheet_extended_exercises_form_h5p_id_field', 'post', array(
'group' => 'worksheet_extended_exercises_meta_box',
'field_type' => 'number',
'label' => 'H5p Form Exercise ID',
'description' => 'This field It\'s the id of the h5p exercise about the Form.', // description for the field
'required_cap' => 'remove_users',
) );
// h5p id
// adds a number field in the first group (with no min/max)
x_add_metadata_field( 'worksheet_extended_exercises_use_h5p_id_field', 'post', array(
'group' => 'worksheet_extended_exercises_meta_box',
'field_type' => 'number',
'label' => 'H5P Use Exercise ID',
'description' => 'This field It\'s the id of the h5p exercise about the Use.', // description for the field
'required_cap' => 'remove_users',
) );
// h5p id
// adds a number field in the first group (with no min/max)
x_add_metadata_field( 'worksheet_extended_exercises_wordsearch_h5p_id_field', 'post', array(
'group' => 'worksheet_extended_exercises_meta_box',
'field_type' => 'number',
'label' => 'H5P WordSearch activity ID',
'description' => 'This field It\'s the id of the WordSearch activity.', // description for the field
'required_cap' => 'remove_users',
) );
}