Add new input in new course with essential theme.

Add new input in new course with essential theme.

by Jorge G. C. -
Number of replies: 4

I am using essential theme.

When I create a new course, Moodle ask we for a fullname, shortname, category, etc... 

I need to find the file which render that block with all of these fields because I want to add a new inputfield to save images.

Where is it??

Thank you!!!


Average of ratings: -
In reply to Jorge G. C.

Re: Add new input in new course with essential theme.

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers
Ok, what version of Moodle and Essential please?
In reply to Gareth J Barnard

Re: Add new input in new course with essential theme.

by Jorge G. C. -

Moodle 3.3 and Essential 3.3.1.5.

I got to create a new inputfield in the form using $mform->addelement(). In addtition I used filemanager to upload images.

Also, I created a new column in the  table of the course to save the paths of my images. I just need to know how I can save the images in the database. While you answer, I will be reading documentation. 

Thank you so much!!!

I show you the function that I used to show the new inputfield below:

$mform->addElement('filemanager', 'attachments', get_string('headerimage'), null,
array('subdirs' => 0, 'maxbytes' => 1000000, 'areamaxbytes' => 1000000, 'maxfiles' => 1,
'accepted_types' => array('.jpg','.jpeg','.png')));


Attachment Captura.JPG
In reply to Jorge G. C.

Re: Add new input in new course with essential theme.

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

I don't think it can be done in M3.3 in a course, only M3.7 -> https://docs.moodle.org/dev/Custom_fields_API - but then in M3.3 you could create custom fields in a custom course format and do things there.

In reply to Gareth J Barnard

Re: Add new input in new course with essential theme.

by john lennon -
How would you get the value in a M3.7 custom course field then?