Developing Custom Module Like Label

Developing Custom Module Like Label

by Hamza Khan -
Number of replies: 4

Hi ! 
I am trying to develope a custom module like label but with some additional fields. I have done most of the part but I am unable to display certian fields on the course view page I have tried the following instructions to override the stated methods but still unsuccessful.

Moodle version : 3.7


Average of ratings: -
In reply to Hamza Khan

Re: Developing Custom Module Like Label

by Mark Johnson -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Hi Hamza, Support for Moodle 3.7 has ended, so I would suggest you upgrade. It's difficult for the community to provide help with old releases of Moodle, since they may be subject to bugs which are fixed in current versions.

Regarding your specific question, it's hard to say what the problem is without seeing your code. Please provide a link to your code in a public repository on a site like GitHub or GitLab so that other developers can see what you have done so far, and suggest what changes you might need ot make.

Average of ratings: Useful (1)
In reply to Hamza Khan

Re: Developing Custom Module Like Label

by Séverin TERRIER -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators
Hi,

I would say that, before developping something, you should always describe precisely what you want to achieve.

Because perhaps there is already something existing that can answer your needs, using Moodle core tools, or existing plugins.

And at least, sometimes someone will point you to something you can take, and update to add what you need.

For exemple, the Unilabel plugin comes to my mind, but not sure it answers your needs.

Séverin
In reply to Séverin TERRIER

Re: Developing Custom Module Like Label

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Might also be able to achieve what the OP wants by using the Generico filter in a regular Moodle label.
In reply to Hamza Khan

Re: Developing Custom Module Like Label

by Mark Sharp -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

If you're looking to add content in the course page, like label, and like folder (which displays a tree of the folder), the function you need to implement is `yourpluginname_get_coursemodule_info` in your plugin's `lib.php` file.

See https://github.com/moodle/moodle/blob/8af7bec81e8da777c3895c7eecaf84dffd24c6be/mod/folder/lib.php#L403

After that, it's down to you to fetch the data you require and output it.