@@ -54,13 +54,15 @@ class mod_opencast_uploadvideo_form extends moodleform {
5454 * Defines forms elements
5555 */
5656 public function definition () {
57+ global $ PAGE ;
5758 $ cmid = $ this ->_customdata ['cmid ' ];
5859 $ ocmoduleinstance = $ this ->_customdata ['moduleinstance ' ];
5960 $ uploadoptions = json_decode ($ ocmoduleinstance ->uploadoptionsjson );
6061 $ simpleuploaddata = mod_upload_helper::get_simple_upload_form_data ($ ocmoduleinstance , $ cmid );
6162 $ ocinstanceformdata = $ simpleuploaddata ['ocinstanceformdata ' ];
6263 $ defaultocinstance = (int ) $ uploadoptions ->selectedocinstanceid ;
6364 $ ocinstancesoptions = $ uploadoptions ->options ;
65+ $ mainrenderer = $ PAGE ->get_renderer ('tool_opencast ' );
6466
6567 $ mform = $ this ->_form ;
6668
@@ -116,7 +118,7 @@ public function definition() {
116118 foreach ($ formdata ->metadatacatalogs as $ field ) {
117119 $ elementid = "{$ field ->name }_ {$ formdata ->ocinstanceid }" ;
118120 $ value = (isset ($ field ->userdefault ) ? $ field ->userdefault : null );
119- $ lbltext = $ this ->try_get_string ($ field ->name , 'block_opencast ' );
121+ $ lbltext = $ this ->try_get_string ($ field ->name , 'tool_opencast ' );
120122
121123 if (!empty ($ ocinstancesoptions ?->{$ formdata ->ocinstanceid }?->metadata?->{$ field ->name }->value )) {
122124 $ value = $ ocinstancesoptions ->{$ formdata ->ocinstanceid }->metadata ->{$ field ->name }->value ;
@@ -156,13 +158,20 @@ public function definition() {
156158 }
157159
158160 if (!empty ($ inplaceobjhtml )) {
159- $ mform ->addElement (
161+ $ element = $ mform ->addElement (
160162 'static ' ,
161163 $ elementid ,
162164 $ lbltext ,
163165 $ inplaceobjhtml
164166 );
165167 $ this ->set_element_toggles ($ mform , $ elementid , $ formdata ->ocinstanceid );
168+
169+ // Check if the description is set for the field, to display it as help icon.
170+ if (isset ($ field ->description ) && !empty ($ field ->description )) {
171+ // Use the renderer to generate a help icon with custom text.
172+ $ element ->_helpbutton = $ mainrenderer ->render_help_icon_with_custom_text (
173+ $ this ->try_get_string ($ field ->name , 'tool_opencast ' ), $ field ->description );
174+ }
166175 }
167176
168177 // We record the required metadata fields to verify them later on.
@@ -187,12 +196,14 @@ public function definition() {
187196 }
188197 $ inplaceobj = new inplace_edit_toggle_visibility ($ inplvisibilitydata );
189198 $ inplaceobjhtml = mod_upload_helper::render_inplace_editable_object ($ inplaceobj );
190- $ mform ->addElement (
199+ $ element = $ mform ->addElement (
191200 'static ' ,
192201 $ elementid ,
193202 $ lbltext ,
194203 $ inplaceobjhtml
195204 );
205+ $ visibilityhelp = get_string ('uploadform_visibility_help ' , 'mod_opencast ' );
206+ $ element ->_helpbutton = $ mainrenderer ->render_help_icon_with_custom_text ($ lbltext , $ visibilityhelp );
196207 $ this ->set_element_toggles ($ mform , $ elementid , $ formdata ->ocinstanceid );
197208 }
198209
@@ -229,12 +240,16 @@ public function definition() {
229240 }
230241 if (!empty ($ inplaceobj )) {
231242 $ inplaceobjhtml = mod_upload_helper::render_inplace_editable_object ($ inplaceobj );
232- $ mform ->addElement (
243+ $ element = $ mform ->addElement (
233244 'static ' ,
234245 $ elementid ,
235246 $ lbltext ,
236247 $ inplaceobjhtml
237248 );
249+ $ processingoptionsdesc = get_string ('uploadform_processing_options_general_help ' , 'mod_opencast ' );
250+ $ element ->_helpbutton = $ mainrenderer ->render_help_icon_with_custom_text (
251+ $ lbltext , $ processingoptionsdesc
252+ );
238253 $ this ->set_element_toggles ($ mform , $ elementid , $ formdata ->ocinstanceid );
239254 }
240255 }
@@ -252,6 +267,8 @@ public function definition() {
252267 $ mform ->addElement ('hidden ' , 'cmid ' , $ cmid );
253268 $ mform ->setType ('cmid ' , PARAM_INT );
254269
270+ $ mform ->setAttributes (['id ' => 'mod-opencast-simple-upload-page ' ] + $ mform ->getAttributes ());
271+
255272 $ mform ->closeHeaderBefore ('buttonar ' );
256273 $ this ->add_action_buttons (true , get_string ('uploadform_submit ' , 'mod_opencast ' ));
257274 }
0 commit comments